<template>
<!-- 收入确认单 -->
<section class="content-box">
  <div>
  <div v-if="isshowList">
    <!--工具条-->
    <el-col :span="24" class="SuppC-toolbar">
      <el-form class="title">
        <div>
          <h2>收入确认单</h2>
          <el-button size="small" class="el-icon-plus" @click="handleAdd">&nbsp;新建&nbsp;</el-button>
          <el-button size="small" @click="search" class="el-icon-search">&nbsp;查询</el-button>
        </div>
        <!-- <el-form-item>
          <el-button size="small" @click="charge" class="el-icon-search red">&nbsp;红字冲销&nbsp;</el-button>
        </el-form-item> -->
        <el-form-item class="cover">
          <div></div>
          <el-popover
            ref="poverMerge"
            placement="bottom"
            width="60"  
            id="min-w"
            trigger="hover"
            :visible-arrow="false">
            <div class="item-img" @click="charge" style="display:block;float:none">
              <span>&#12288;&#12288;&#12288;红字冲销</span>
            </div>
          </el-popover>
          <div class="list-img" v-popover:poverMerge>
            <img class="SuppC-common-icon" src="../../../static/content/images/Common/common-more.png" alt=""/>
          </div>         
        </el-form-item>
      </el-form>
      
    </el-col>
    <!-- <el-col :span="24" class="SuppC-toolbar">
      <el-form class="title">
        <div>
          <h2>收入确认单</h2>
          <img @click="handleAdd" class="SuppC-common-icon" src="../../../static/content/images/Common/common-add.png" alt=""/>
        </div>
        <el-form-item class="cover">
          <div class="list-img" @click="search">
            <img class="SuppC-common-icon" src="../../../static/content/images/Common/common-query.png" alt=""/>
            <span>查询</span>
          </div>
        </el-form-item>
      </el-form>
    </el-col> -->
    <!-- 列表 -->
    <!-- <el-table class="indexList" v-if="IncomeList" :data="IncomeList" highlight-current-row v-loading="loading" element-loading-text="正在加载中">
      <el-table-column label="序号" type="index" width="100" sortable>
      </el-table-column>
      <el-table-column prop="Income_DocDate" label="日期" :formatter="formatDate" sortable>
      </el-table-column>
      <el-table-column prop="Income_DocNo" label="编号" sortable>
      </el-table-column>
      <el-table-column prop="Income_Title" label="标题" show-overflow-tooltip>
      </el-table-column>
      <el-table-column prop="Custom_Name" label="客户" show-overflow-tooltip sortable>
      </el-table-column>
      <el-table-column prop="UserName" label="申请人">
      </el-table-column>
      <el-table-column prop="Income_TotalIncomeMoney" label="总金额" sortable>
      </el-table-column>
      <el-table-column prop="DocStatus" label="状态" sortable>
      </el-table-column>
      <el-table-column label="操作" min-width="150">
        <template slot-scope="scope">
          <el-button-group>
  					<el-button size="small" @click="handleEdit(scope.$index, scope.row)">编辑</el-button> 
  					<el-button size="small" v-if="scope.row.DocStatus==='待审核'"  @click="repeal(scope.$index, scope.row)">撤销</el-button>
  					<el-button  size="small" @click="checkflowRow(scope.$index, scope.row)">查看流程</el-button>
  					<el-button  size="small" @click="handleDel(scope.$index, scope.row)">删除</el-button>
            <el-button size="small" v-if="scope.row.AttachmentCount>0" class="icon iconfont icon-attachment"></el-button>
          </el-button-group>
        </template>
			</el-table-column>
		</el-table> -->
    <el-table class="indexList" v-if="IncomeList" :data="IncomeList" @row-click="add" @row-dblclick="handleEdit" @cell-mouse-enter="cellMouseEnterTwoFn" @cell-mouse-leave="cellMouseLeaveFn" highlight-current-row v-loading="loading" element-loading-text="正在加载中" style="100%">
      <el-table-column prop="Income_DocDate" label="日期" :formatter="formatDate" sortable>
      </el-table-column>
      <el-table-column prop="Income_DocNo" label="单号" sortable>
      </el-table-column>
      <el-table-column prop="Income_TotalIncomeMoney" label="金额" sortable>
      </el-table-column>
      <el-table-column prop="Custom_Name" label="客户" show-overflow-tooltip sortable>
      </el-table-column>
      <el-table-column prop="Income_Title" label="业务描述" min-width="150" show-overflow-tooltip>
      </el-table-column>
      <el-table-column prop="DocStatus" label="状态" sortable>
      </el-table-column>
      <el-table-column label="操作" min-width="150">
        <template slot-scope="scope">
          <!-- <el-button-group>
  					<el-button size="small" @click="handleEdit(scope.$index, scope.row)">编辑</el-button> 
  					<el-button size="small" v-if="scope.row.DocStatus==='待审核'"  @click="repeal(scope.$index, scope.row)">撤销</el-button>
  					<el-button  size="small" @click="checkflowRow(scope.$index, scope.row)">查看流程</el-button>
  					<el-button  size="small" @click="handleDel(scope.$index, scope.row)">删除</el-button>
            <el-button size="small" v-if="scope.row.AttachmentCount>0" class="icon iconfont icon-attachment"></el-button>
          </el-button-group> -->
          <div v-if="scope.row.Income_DocNo==mouse_enter_Rcv_DocNO">
          <!-- <div>  -->
            <div  v-if="scope.row.DocStatus==='待审核'" class="list-img" @click.stop="repeal(scope.$index, scope.row)">
              <!-- 撤销 -->
              <img class="common-icon" src="../../../static/content/images/Common/common-repeal.png" alt=""/>
            </div>
            <div v-if="scope.row.DocStatus!=='新建'" class="list-img" @click.stop="checkflowRow(scope.$index, scope.row)">
              <!-- 查看流程 -->
              <img class="common-icon" src="../../../static/content/images/Common/common-flow.png" alt=""/>
            </div>
            <div v-if="scope.row.DocStatus==='新建'" class="list-img" @click.stop="handleDel(scope.$index, scope.row)">
              <!-- 删除 -->
              <img class="common-icon" src="../../../static/content/images/Common/common-list-dele.png" alt=""/>
            </div>
            <div  v-if="scope.row.AttachmentCount>0" class="list-img">
              <!-- 附件 -->
              <img class="common-icon" src="../../../static/content/images/Common/common-attach.png" alt=""/>
            </div>
          </div>   
        </template>
			</el-table-column>
		</el-table>

    <!--工具条-->
    <el-col :span="24" class="toolbar">
      <el-pagination @current-change="changePage" layout="prev, pager, next" :page-size="rows" :current-page="currentPage" :total="total" style="float:right;">
      </el-pagination>
    </el-col>

    <!--流程图-->
    <el-dialog title="流程执行情况" :visible.sync="checkflowRowVisible" :modal-append-to-body="false" align="center">
        <el-table :data="docView" header-align="center"  v-loading="docViewloading" element-loading-text="拼命刷新中...">
          <el-table-column property="PlanUser" label="操作人"></el-table-column>
          <el-table-column property="StepName" label="步骤名称"></el-table-column>
          <el-table-column property="OpDate" label="时间"></el-table-column>
          <el-table-column property="OpRemark" label="备注"></el-table-column>
        </el-table>
    </el-dialog>
    </div>
    <!-- 新建页面 -->
    <div v-if="isshowAdd">
			<!-- 导航条 -->
			<div class="flex-top">
				<div>
					<i class="el-icon-arrow-left back" @click="addToBack"></i>
					<span style="font-size:20px;vertical-align:middle;margin:0 10px;">
						收入确认单 </span>
					<!-- <small>
						<span>状态：</span>
						<el-tag type="success">新增</el-tag>
					</small> -->
				</div>
				<!-- 右侧 -->
				<div class="flex">
					<span class="wrapper cover">
            <el-button-group>
              <el-button size="small" @click="openUploadDialog">
                <i class="icon iconfont icon-shangchuan"></i>&nbsp;附件
              </el-button>            
              <el-button size="small" @click="addSave">
                <i class="icon iconfont icon-baocun"></i>&nbsp;保存
              </el-button>
              <el-button size="small" @click="addSubmit">
                <i class="icon iconfont icon-tijiao"></i>&nbsp;提交
              </el-button>
            </el-button-group>
					</span>
				</div>
			</div>
      <div class="flex-content">
        <!-- 中部 -->
        <main class="Income main">
          <div class="main-left">
            <div v-if="DocNo">					
              <h3>单号:</h3>
              <strong>{{DocNo}}</strong>
            </div>
            <div>
              <h3>日期：</h3>
              <div class="flex">
                <el-date-picker type="date" v-model="docDate" placeholder="选择日期">
                </el-date-picker>
              </div>
            </div>
          </div>
          <div class="main-right">
            <div class="left-form" style="width: 100%;">
              <el-row>
                <el-col :span="12">
                  <div>
                    <span class="ele-text text-money text-right">客&emsp;&emsp;户</span>
                    <el-tooltip 
                    content="请您输入客户名称快捷查询" 
                    placement="top">
                      <el-select 
                      class="ele-select element-select" 
                      v-model="custom"  
                      placeholder="请输入关键字" 
                      :remote-method="remoteMethod"
                      remote
                      filterable
                      clearable>
                        <el-option 
                        v-for="(item,index) in Customer" 
                        :key="index" 
                        :value='item.AI_Code' 
                        :label="item.AI_Name">
                        </el-option>
                      </el-select>
                    </el-tooltip>
                  </div>
                  <div>
                    <span class="ele-text text-money text-right">业&ensp;务&ensp;员</span>
                    <el-select class="ele-select element-select" v-model="sales"  placeholder="请输入业务员名称" filterable>
                      <el-option v-for="item in SalesEmp" 
                      :key="item.ID" 
                      :value="item.ID" 
                      :label="item.REALNAME">
                      </el-option>
                    </el-select>
                  </div>
                  <div>
                    <span class="text-money">销售金额(含税)：</span>
                    <input type="text" class='applied' @blur="doToFixedFn('TotalIncomeMoney')" @keyup="onlyNumBasicFn('TotalIncomeMoney')" v-model="TotalIncomeMoney">                  
                  </div>                  
                </el-col>
                <el-col :span="12">
                  <span class="ele-text">业务描述</span>
                  <el-input
                    class="textarea-title input-resize-none"
                    type="textarea"
                    :rows="6"
                    placeholder="请输入内容"
                    v-model="describe">
                  </el-input>
                </el-col>
                <!-- <el-col :span="12">
                  <span class="ele-text">业务员</span>
                  <el-select class="ele-select" v-model="sales"  placeholder="请输入业务员名称" filterable>
                    <el-option v-for="item in SalesEmp" 
                    :key="item.ID" 
                    :value="item.ID" 
                    :label="item.REALNAME">
                    </el-option>
                  </el-select>
                </el-col> -->
                <!-- <el-col :span="24">
                  <span class="text-money">销售金额(含税)：</span>
                  <input type="text" class='applied' v-model="TotalIncomeMoney">
                </el-col> -->
                <!-- <el-col :span="24" class="expense-title-wrapper">
                  <span class="ele-text">业务描述</span>
                  <el-input
                    class="textarea-title"
                    type="textarea"
                    :rows="3"
                    placeholder="请输入内容"
                    v-model="describe">
                  </el-input>
                </el-col> -->
              </el-row>
            </div>
            <!-- <div class="right-form">
              <span>业务描述</span><br><br>
              <el-input
                type="textarea"
                :rows="10"
                placeholder="请输入内容"
                v-model="describe">
              </el-input>
            </div> -->
          </div>
        </main>
        <!--底部-->
        <div class="budget-two">
          <div class="nav">
            <div class="inline-block">
              <el-switch 
              v-model="isSwitch" 
              @change="showChange(isSwitch)"
              on-color="#13ce66"
              off-color="#ff4949"></el-switch>&#12288;核销预收款
            </div>
            <div class="inline-block ml20">
              <el-switch 
              v-model="isOpenBillSwitch" 
              @change="showValueAddTaxChange(isOpenBillSwitch)"
              on-color="#13ce66"
              off-color="#ff4949"></el-switch>&#12288;开具发票
            </div> 
            <div v-if="isShowPayment" class="cover">
              <!-- <el-button size="small" @click="getPaymentAddDiaLog">选择出纳收款单（预收款）</el-button> -->
              <el-dialog title="选择出纳收款单（预收款）" @close="cancel" :visible.sync="dialogPayVisible" :modal-append-to-body="false" align="center" size="small">
                <el-table :data="paymentsTemp" border  highlight-current-row max-height="300" class="th-text-center">
                  <el-table-column label="单号">
                    <template slot-scope="scope">
                    {{ scope.row.Rcv_DocNO }}
                    </template>
                  </el-table-column>
                  <el-table-column label="金额">
                    <template slot-scope="scope">
                    {{ scope.row.Rcv_TotalRcvMoney==0 ? '' : scope.row.Rcv_TotalRcvMoney}}
                    </template>
                  </el-table-column>
                  <el-table-column label="未收款金额">
                    <template slot-scope="scope">
                    {{ scope.row.Surplus==0 ? '' : scope.row.Surplus}}
                    </template>
                  </el-table-column>
                  <el-table-column label="本次收款金额">
                    <template slot-scope="scope">
                      <div class="full-box">
                        <el-input type="text" @blur="doToFixed(scope,'row','Money')" @keyup.native="onlyNumObjFn(scope,'row','Money')" v-model="scope.row.Money" :placeholder="'请输入金额'">
                        </el-input>
                      </div>
                    </template>
                  </el-table-column>
                  <el-table-column label="摘要">
                    <template slot-scope="scope">
                    {{ scope.row.Rcv_Title }}
                    </template>
                  </el-table-column>
                </el-table>
                <span slot="footer" class="dialog-footer">
                  <el-button size="small" @click="cancel">取 消</el-button>
                  <el-button size="small" type="primary" @click="confirm">确 定</el-button>
                </span>
              </el-dialog>
              <div v-if="paymentsPrint" class="padding-top-10"> 
                <div class="nav">
                  <span><i class="icon iconfont icon-iconfontcolor52"></i>预收明细</span>
                </div>
                <!-- <el-table :data="paymentsPrint" @click.native="dialogPayVisible=true" @cell-mouse-enter="cellMouseEnterFn" @cell-mouse-leave="cellMouseLeaveFn" border style="width: 100%;" highlight-current-row max-height="300" class="th-text-center"> -->
                <el-table :data="paymentsPrint" @click.native="openDialogPay" @cell-mouse-enter="cellMouseEnterFn" @cell-mouse-leave="cellMouseLeaveFn" border style="width: 100%;" highlight-current-row max-height="300" class="th-text-center">  
                  <el-table-column label="操作" width="80">
                    <template slot-scope="scope">
                      <div class="text-align-center" v-if="scope.row.Rcv_DocNO==mouse_enter_Rcv_DocNO">
                        <button size="small" class="oper-btn" @click.stop="changeMoneyToZero(scope)"><img class="common-icon" src="/static/content/images/Common/common-dele.png"/></button>
                      </div>
                    </template>                  
                  </el-table-column> 
                  <el-table-column label="单号" width="120">
                    <template slot-scope="scope">
                    {{ scope.row.Rcv_DocNO }}
                    </template>
                  </el-table-column>
                  <el-table-column label="金额" width="120">
                    <template slot-scope="scope">
                    {{ scope.row.Rcv_TotalRcvMoney==0 ? '' : scope.row.Rcv_TotalRcvMoney}}
                    </template>
                  </el-table-column>
                  <el-table-column label="未收款金额" width="120">
                    <template slot-scope="scope">
                    {{ scope.row.Surplus==0 ? '' : scope.row.Surplus}}
                    </template>
                  </el-table-column>
                  <el-table-column label="本次收款金额" width="150">
                    <template slot-scope="scope">
                    {{ scope.row.Money }}
                    </template>
                  </el-table-column>
                  <el-table-column label="摘要">
                    <template slot-scope="scope">
                    {{ scope.row.Rcv_Title }}
                    </template>
                  </el-table-column>
                </el-table>
                <div class="clearfloat">
                  <div class="total-box">合计：<span class="Count-text">{{Count1}}</span></div>
                </div>
              </div>
            </div>
          </div>
        
          <div v-if="isAdvanceDetails" class="padding-size-10">
            <!-- <div style="margin-left:10px;" class="cover">  
              合计：<span class="Count">{{Count}}</span>&#12288;               
              <el-button size="small" class="add-button" @click="addlist">添加预算明细</el-button>
            </div> -->
            <div class="nav">
              <span><i class="icon iconfont icon-iconfontcolor52"></i>收入明细</span>
            </div>              
            <table class="cusTable" border="1" width="100%">
              <tr>
                <!-- <th>金额</th>
                <th>部门</th>
                <th>收入类型</th>
                <th>产品</th>
                <th>操作</th> -->
                <th>操作</th>
                <th>部门</th>
                <th>收入类型</th>
                <th>产品</th>
                <th>金额</th>
              </tr>
              <tr v-for="(i,index) in detail" :key="index" class="cusTable-tr">
                <td width="80">
                  <!-- <el-button size="small" @click="handleDelete(index)" type="danger" class="dele">删除</el-button> -->
                  <div class="oper-btn-wrapper">
                    <button size="small" @click.stop="handleDelete(index)" class="oper-btn"><img class="common-icon" src="/static/content/images/Common/common-dele.png"/></button>
                    <button size="small" @click.stop="addlist" class="oper-btn"><img class="common-icon" src="/static/content/images/Common/common-add.png"/></button>
                  </div>                  
                </td>
                <td>      
                  <el-select class="formVal full-box" v-model="i.Department" filterable>
                    <el-option v-for="(item,index) in baseDeptList" :value="item.CODE" :key="index" :label="item.FULLNAME">
                    </el-option>
                  </el-select>
                </td>
                <td>
                  <el-select class="formVal full-box" v-model="i.BudgetItem">   
                    <el-option v-for="(item,index) in budgetItemList" :value="item.BudgetItem_Code" :key="index" :label="item.BudgetItem_FullName">
                    </el-option>
                  </el-select>
                </td>
                <td>
                  <el-select class="formVal full-box" v-model="i.Product" filterable>   
                    <el-option v-for="(item,index) in productList" :value="item.Product_Code" :key="index" :label="item.Product_Name">
                    </el-option>
                  </el-select>
                </td>
                <td>
                  <el-input type="text" @blur="doToFixed(i,'IncomeMoney')" @keyup.native="onlyNumObjFn(i,'IncomeMoney')" @keydown.enter.native="addlist" v-model="i.IncomeMoney" class="formval-money full-box" :placeholder="'请输入金额'"></el-input>
                </td>
              </tr>
            </table>
            <div class="clearfloat">
              <div class="total-box">合计：<span class="Count-text">{{Count}}</span></div>
            </div>
          </div>
        </div>
      </div>
    </div>
    <!-- 编辑页面 -->
    <div v-if="isshowEdit">
			<!-- 导航条 -->
			<div class="flex-top">
				<div>
					<i class="el-icon-arrow-left back" @click="editToBack"></i>
					<span style="font-size:20px;vertical-align:middle;margin:0 10px;">
						收入确认单 </span>
					<!-- <small>
						<span>状态：</span>
						<el-tag type="success">{{Type===0?'新增':Type===1?'修改':Type===2?'查看':Type===3?'待审核':''}}</el-tag>
					</small> -->
				</div>
				<!-- 右侧 -->
				<div class="flex">
					<span class="wrapper cover">
            <!-- <el-button-group>
              <el-button size="small" @click="openUploadDialog">
                <i class="icon iconfont icon-shangchuan"></i>&nbsp;附件
              </el-button>
              <el-button size="small" @click="auditIncome" :disabled="Type===1||Type===2">
                <i class="icon iconfont icon-shenhe"></i>&nbsp;审核
              </el-button>
              <el-button size="small" @click="rejectIncome" :disabled="Type===1||Type===2">
                <i class="icon iconfont icon-bohui"></i>&nbsp;驳回
              </el-button>
              <el-button size="small" @click="Communication">
                <i class="icon iconfont icon-chat-with-doctor"></i>&nbsp;沟通
              </el-button>
              <el-button size="small" @click="editSave" :disabled="Type===2||Type===3">
                <i class="icon iconfont icon-baocun"></i>&nbsp;保存
              </el-button>
              <el-button size="small" @click="editSubmit" :disabled="Type===2||Type===3">
                <i class="icon iconfont icon-tijiao"></i>&nbsp;提交
              </el-button>
              <el-button size="small" @click="getPrint">
                <i class="icon iconfont icon-yy"></i>&nbsp;打印
              </el-button>
            </el-button-group> -->
            <el-button-group>
              <el-button size="small" @click="openUploadDialog" :disabled="fjBtnDisabled">
                <i class="icon iconfont icon-shangchuan"></i>&nbsp;附件
              </el-button>
              <el-button size="small" @click="Communication" v-if="Type!==0" :disabled="communicateButtonDisabled">
                <i class="icon iconfont icon-chat-with-doctor"></i>&nbsp;沟通
              </el-button>
              <el-button size="small" @click="checkflow" v-if="Type===2||Type===3">
                <i class="icon iconfont icon-liucheng"></i>&nbsp;流程
              </el-button>
              <el-button size="small" @click="rejectIncome" v-if="Type===3">
                <i class="icon iconfont icon-bohui"></i>&nbsp;驳回
              </el-button>
              <el-button size="small" @click="editSave" v-if="Type===0||Type===1">
                <i class="icon iconfont icon-baocun"></i>&nbsp;保存
              </el-button>
              <el-button size="small" @click="editSubmit" v-if="Type===0||Type===1">
                <i class="icon iconfont icon-tijiao"></i>&nbsp;提交
              </el-button>
              <el-button size="small" @click="getPrint" v-if="Type===2">
                <i class="icon iconfont icon-yy"></i>&nbsp;打印
              </el-button>
              <el-button size="small" @click="auditIncome" v-if="Type===3">
                <i class="icon iconfont icon-shenhe"></i>&nbsp;同意
              </el-button>
            </el-button-group>
					</span>
				</div>
        <el-dialog title="请确认会计期间" :visible.sync="dialogPeriodVisible" :modal-append-to-body="false" size="tiny">
          <strong>你选择的会计期间是：</strong>              
          <el-select v-model="period" placeholder="请选择">
            <el-option
              v-for="(item,index) in PeriodList"
              :key="index"
              :label="item.Period_Name"
              :value="item.Period_Code">
            </el-option>
          </el-select>
          &#12288;&#12288;
          <br>
          <strong>你选择的日期是：</strong>
          <el-date-picker type="date" v-model="docDate" placeholder="选择日期">
					</el-date-picker>
          <span slot="footer" class="dialog-footer">
            <el-button type="primary" @click="auditDetermine" :loading="fullscreenLoading">审核</el-button>
            <el-button @click="CancelPeriod">取 消</el-button>          
          </span>
        </el-dialog>
        
        <!-- 沟通 -->
        <el-dialog
          class="el-dialog__body-padding"
          :visible.sync="dialogCommunicationVisible"
          :modal-append-to-body="false"
          size="tiny"
          style="line-height: normal;">
          <p v-if="CommunicationContentList.length!==0" class="title">沟通内容:</p>
          <ul v-if="CommunicationContentList.length!==0" class="Communication-Two mt-15 mb-15" ref="content">
            <li v-for="(item,index) in CommunicationContentList" :key="index" :class="index!==CommunicationContentList.length-1?'mb-10':''">
              <el-row>
                <el-col :span="4" class="Communication-left">
                  <a href="javascript:;"><img :src="item.Img" alt="" class="round"/></a>
                  <p class="name" style="color: #13ce66;">{{item.CreateByName}}</p>
                </el-col>
                <el-col :span="20" style="height: 78px;">              
                  <div class="message1">      
                    <p class="content">{{item.CC_Content}}</p>
                    <p class="date"><el-tag type="primary">{{item.SysCreateDate}}</el-tag></p>
                  </div>
                </el-col>
              </el-row>
            </li>
            <!-- <li v-if="this.CommunicationContentList.length==0"><p class="not-communication"><i class="el-icon-warning"></i>未有沟通</p></li> -->
          </ul>
          <p v-if="communiTypes===3" class="title">发起沟通:</p>
          <el-row v-if="communiTypes===3" class="padding-top-15">
            <el-col :span="17">
              <el-select v-model="launch" multiple filterable="" allow-create placeholder="请选择沟通对象" style="width:80%;">
                <el-option v-for="(item,index) in LaunchList" :key="index" :label="item.RealName" :value="item.Id">
                </el-option>
              </el-select>
            </el-col>
            <el-col :span="2">
              <el-checkbox v-model="launchChecked" @change="launchChange(launchChecked)">允许提交者编辑单据</el-checkbox>
            </el-col>
          </el-row>
          <!-- <el-row v-if="(this.communiTypes!==0 && this.communiTypes!==2) || this.isshowLauch==true">
            <el-col :span="21">
              <el-input v-model="contentInput" placeholder="请输入内容"></el-input>
            </el-col>
            <el-col :span="2">          
              <el-button style="margin-left:10px;" type="primary" @click="CommunicationDetermine">发送</el-button>
            </el-col>          
          </el-row> -->
          <!-- <p v-if="(this.communiTypes!==0 && this.communiTypes!==2) || this.isshowLauch==true" v-show="this.CommunicationContentList.length!==0" class="title padding-top-15">回复沟通:</p> -->
          <div v-if="(this.communiTypes!==0 && this.communiTypes!==2) || this.isshowLauch==true" v-show="this.CommunicationContentList.length!==0">
            <p v-if="this.communiTypes!==3" class="title padding-top-15">回复沟通:</p>
          </div>
          <el-row v-if="(this.communiTypes!==0 && this.communiTypes!==2) || this.isshowLauch==true" class="padding-top-15">
            <el-col :span="24">
              <el-input v-model="contentInput" type="textarea" :rows="3" placeholder="请输入内容"></el-input>
            </el-col>     
          </el-row>
          <el-row v-if="(this.communiTypes!==0 && this.communiTypes!==2) || this.isshowLauch==true" class="padding-top-15">
            <el-col :span="24">          
              <el-button style="float: right;" type="primary" @click="CommunicationDetermine">发送</el-button>
            </el-col>          
          </el-row>
        </el-dialog>
			</div>
      <div class="flex-content">
        <!-- 中部 -->
        <main class="Income main">
          <div class="main-left">
            <div v-if="Type == 1 || Type == 2 || Type == 3">					
              <h3>单号:</h3>
              <strong>{{DocNo}}</strong>
            </div>
            <div>
              <h3>日期：</h3>
              <div class="flex">
                <el-date-picker type="date" v-model="docDate" :disabled="Type===2||Type===3" placeholder="选择日期">
                </el-date-picker>
              </div>
            </div>
          </div>
          <div class="main-right">
            <div class="left-form" style="width: 100%;">
              <!-- <el-row>
                <el-col :span="12">
                  <span>客户</span>
                  <el-tooltip 
                  content="请您输入客户名称快捷查询" 
                  placement="top">
                    <el-select 
                    :disabled="Type===2||Type===3" 
                    v-model="custom"  
                    placeholder="请输入客户名" 
                    :remote-method="remoteMethod"
                    remote
                    filterable
                    clearable 
                    style="margin-left:50px;">
                      <el-option 
                      v-for="(item,index) in Customer" 
                      :key="index" 
                      :value='item.Code' 
                      :label='item.Name'>
                      </el-option>
                    </el-select>
                  </el-tooltip>
                </el-col>
                <el-col :span="12">
                  <span>业务员</span>
                  <el-select :disabled="Type===2||Type===3" v-model="sales"  placeholder="请选择" filterable style="margin-left:50px;">
                    <el-option v-for="item in SalesEmp" 
                    :key="item.ID" 
                    :value="item.ID" 
                    :label="item.REALNAME">
                    </el-option>
                  </el-select>
                </el-col>
                <el-col :span="12">
                  <span class="text-money">销售金额(含税)：</span>
                  <input type="text" class='applied' :disabled="Type===2||Type===3" v-model="TotalIncomeMoney">
                </el-col>
                <el-col :span="24" class="expense-title-wrapper">
                  <span class="ele-text">业务描述</span>
                  <el-input
                    class="textarea-title"
                    type="textarea"
                    :rows="3"
                    placeholder="请输入内容"
                    v-model="describe"
                    :disabled="Type===2||Type===3">
                  </el-input>                  
                </el-col>
              </el-row> -->
              <el-row>
                <el-col :span="12">
                  <div>
                    <span class="ele-text text-money text-right">客&emsp;&emsp;户</span>
                    <el-tooltip 
                    content="请您输入客户名称快捷查询" 
                    placement="top">
                      <!-- <el-select 
                      :disabled="Type===2||Type===3" 
                      v-model="custom"  
                      placeholder="请输入客户名" 
                      :remote-method="remoteMethod"
                      remote
                      filterable
                      clearable 
                      style="margin-left:50px;">
                        <el-option 
                        v-for="(item,index) in Customer" 
                        :key="index" 
                        :value='item.Code' 
                        :label='item.Name'>
                        </el-option>
                      </el-select> -->
                      <el-select 
                      :disabled="Type===2||Type===3" 
                      v-model="custom"  
                      placeholder="请输入客户名" 
                      :remote-method="remoteMethod"
                      remote
                      filterable
                      clearable 
                      class="ele-select element-select">
                        <el-option 
                        v-for="(item,index) in Customer" 
                        :key="index" 
                        :value='item.AI_Code' 
                        :label='item.AI_Name'>
                        </el-option>
                      </el-select>
                    </el-tooltip>
                  </div>
                  <div>
                    <span class="ele-text text-money text-right">业&ensp;务&ensp;员</span>
                    <!-- <el-select :disabled="Type===2||Type===3" v-model="sales"  placeholder="请选择" filterable style="margin-left:50px;">
                      <el-option v-for="item in SalesEmp" 
                      :key="item.ID" 
                      :value="item.ID" 
                      :label="item.REALNAME">
                      </el-option>
                    </el-select>-->
                    <el-select class="ele-select element-select" :disabled="Type===2||Type===3" v-model="sales"  placeholder="请选择" filterable>
                      <el-option v-for="item in SalesEmp" 
                      :key="item.ID" 
                      :value="item.ID" 
                      :label="item.REALNAME">
                      </el-option>
                    </el-select>    
                  </div>
                  <div>
                    <span class="text-money">销售金额(含税)：</span>
                    <input type="text" @blur="doToFixedFn('TotalIncomeMoney')" @keyup="onlyNumBasicFn('TotalIncomeMoney')" class='applied' :disabled="Type===2||Type===3" v-model="TotalIncomeMoney">
                  </div>
                </el-col>
                <el-col :span="12">
                  <div>
                    <span class="ele-text">业务描述</span>
                    <el-input
                      class="textarea-title input-resize-none"
                      type="textarea"
                      :rows="6"
                      placeholder="请输入内容"
                      v-model="describe"
                      :disabled="Type===2||Type===3">
                    </el-input>                    
                  </div>                  
                </el-col>
              </el-row>
            </div>
            <div class="right-form">
              <!-- <span>业务描述</span><br><br>
              <el-input
                type="textarea"
                :rows="10"
                placeholder="请输入内容"
                v-model="describe"
                :disabled="Type===2||Type===3">
              </el-input> -->
            </div>
          </div>
        </main>
        <!--底部-->
        <div class="budget-two">
          
          <div class="nav">
            <div class="inline-block">
              <el-switch 
              v-model="isSwitch" 
              @change="showChange(isSwitch)" 
              :disabled="Type===2||Type===3"
              on-color="#13ce66"
              off-color="#ff4949"></el-switch>&#12288;核销预收款
            </div>
            <div class="inline-block ml20">
              <el-switch
              :disabled="Type===2||Type===3" 
              v-model="isOpenBillSwitch" 
              @change="showValueAddTaxChange(isOpenBillSwitch)"
              on-color="#13ce66"
              off-color="#ff4949"></el-switch>&#12288;开具发票
            </div>
            <div v-if="isShowPayment" class="cover">
              <!-- <el-button size="small" @click="getPaymentAddDiaLog"  :disabled="Type===2||Type===3">选择出纳收款单（预收款）</el-button> -->
              <el-dialog title="选择出纳收款单（预收款）" @close="cancel" :visible.sync="dialogPayVisible" :modal-append-to-body="false" align="center" size="small">
                <el-table :data="paymentsTemp" border class="th-text-center"  highlight-current-row max-height="300">
                  <el-table-column label="单号">
                    <template slot-scope="scope">
                    {{ scope.row.Rcv_DocNO }}
                    </template>
                  </el-table-column>
                  <el-table-column label="金额">
                    <template slot-scope="scope">
                    {{ scope.row.Rcv_TotalRcvMoney==0 ? '' : scope.row.Rcv_TotalRcvMoney}}
                    </template>
                  </el-table-column>
                  <el-table-column label="未收款金额">
                    <template slot-scope="scope">
                    {{ scope.row.Surplus==0 ? '' : scope.row.Surplus}}
                    </template>
                  </el-table-column>
                  <el-table-column label="本次收款金额">
                    <template slot-scope="scope">
                    <el-input type="text" class="full-box" :autofocus="true" @blur="doToFixed(scope,'row','Money')" @keyup.native="onlyNumObjFn(scope,'row','Money')" v-model="scope.row.Money" :placeholder="'请输入金额'">
                    </el-input>
                    </template>
                  </el-table-column>
                  <el-table-column label="摘要">
                    <template slot-scope="scope">
                    {{ scope.row.Rcv_Title }}
                    </template>
                  </el-table-column>
                </el-table>
                <span slot="footer" class="dialog-footer">
                  <el-button @click="cancel">取 消</el-button>
                  <el-button type="primary" @click="confirm">确 定</el-button>
                </span>
              </el-dialog>  
              <div v-if="paymentsPrint" class="padding-top-10">  
                <div class="nav">
                  <span><i class="icon iconfont icon-iconfontcolor52"></i>预收明细</span>
                </div>
                <!-- <el-table border class="th-text-center" @click.native="(Type===2||Type===3)?'':dialogPayVisible=true" @cell-mouse-enter="cellMouseEnterFn" @cell-mouse-leave="cellMouseLeaveFn" :data="paymentsPrint" style="width: 100%;" highlight-current-row max-height="300"> -->
                <el-table border class="th-text-center" @click.native="openDialogPay" @cell-mouse-enter="cellMouseEnterFn" @cell-mouse-leave="cellMouseLeaveFn" :data="paymentsPrint" style="width: 100%;" highlight-current-row max-height="300">
                  <!-- <el-table-column label="操作" width="80">
                    <template slot-scope="scope">
                      <div class="text-align-center" v-if="scope.row.Borrow_DocNO==mouse_enter_Borrow_DocNO">
                        <button size="small" v-if="!(Type===2||Type===3)" @click.stop="changeMoneyToZeroEdit(scope)" class="oper-btn"><img class="common-icon" src="/static/content/images/Common/common-dele.png"/></button>
                      </div>
                    </template>                  
                  </el-table-column> -->
                  <el-table-column label="操作" width="80">
                    <template slot-scope="scope">
                      <div class="text-align-center" v-if="scope.row.Rcv_DocNO==mouse_enter_Rcv_DocNO">
                        <button size="small" v-if="!(Type===2||Type===3)" class="oper-btn" @click.stop="changeMoneyToZero(scope)"><img class="common-icon" src="/static/content/images/Common/common-dele.png"/></button>
                      </div>
                    </template>                  
                  </el-table-column>                
                  <el-table-column label="单号" width="120">
                    <template slot-scope="scope">
                    {{ scope.row.Rcv_DocNO }}
                    </template>
                  </el-table-column>
                  <el-table-column label="金额" width="120">
                    <template slot-scope="scope">
                    {{ scope.row.Rcv_TotalRcvMoney==0 ? '' : scope.row.Rcv_TotalRcvMoney}}
                    </template>
                  </el-table-column>
                  <el-table-column label="未收款金额" width="120">
                    <template slot-scope="scope">
                    {{ scope.row.Surplus==0 ? '' : scope.row.Surplus}}
                    </template>
                  </el-table-column>
                  <el-table-column label="本次收款金额" width="150">
                    <template slot-scope="scope">
                    {{ scope.row.Money }}
                    </template>
                  </el-table-column>
                  <el-table-column label="摘要">
                    <template slot-scope="scope">
                    {{ scope.row.Rcv_Title }}
                    </template>
                  </el-table-column>
                </el-table>
                <div class="clearfloat">
                  <div class="total-box">合计：<span class="Count-text">{{Count1}}</span></div>
                </div>
              </div>
            </div>
          </div>
          
          <div v-if="isAdvanceDetails" class="padding-size-10">
            <!-- <div style="margin-left:10px;" class="cover">
              合计：<span class="Count">{{Count}}</span>&#12288;            
              <el-button size="small" class="add-button" @click="addlist" :disabled="Type===2||Type===3">添加预算明细</el-button>
            </div> -->
            <div class="nav">
              <span><i class="icon iconfont icon-iconfontcolor52"></i>收入明细</span>
            </div> 
            <table class="cusTable" border="1">
              <tr>
                <!-- <th>金额</th>
                <th>部门</th>
                <th>收入类型</th>
                <th>产品</th>
                <th>操作</th> -->
                <th>操作</th>
                <th>部门</th>
                <th>收入类型</th>
                <th>产品</th>
                <th>金额</th>
              </tr>
              <tr v-for="(i,index) in detail" :key="index" class="cusTable-tr">
                <!-- 遍历初始化的detail添加行空数据 -->
                <td width="80">
                  <!-- <el-button size="small" @click="handleDelete(index)" type="danger" class="dele" :disabled="Type===2||Type===3">删除</el-button> -->
                  <div class="oper-btn-wrapper">
                    <button size="small" v-if="!(Type===2||Type===3)" @click.stop="handleDelete(index)" class="oper-btn"><img class="common-icon" src="/static/content/images/Common/common-dele.png"/></button>
                    <button size="small" v-if="!(Type===2||Type===3)" @click.stop="addlist" class="oper-btn"><img class="common-icon" src="/static/content/images/Common/common-add.png"/></button>
                  </div>   
                </td>
                <td>      
                  <el-select class="formVal full-box" v-model="i.Department" :disabled="Type===2||Type===3" filterable>
                    <!-- v-model => 部门 -->
                    <el-option v-for="(item,index) in baseDeptList" :value="item.CODE" :key="index" :label="item.FULLNAME">
                    </el-option>
                  </el-select>
                </td>
                <td>
                  <el-select class="formVal full-box" v-model="i.BudgetItem" :disabled="Type===2||Type===3">   
                    <!-- v-model => 类型 -->
                    <el-option v-for="(item,index) in budgetItemList" :value="item.BudgetItem_Code" :key="index" :label="item.BudgetItem_FullName">
                    </el-option>
                  </el-select>
                </td>
                <td>
                  <el-select class="formVal full-box" v-model="i.Product" :disabled="Type===2||Type===3" filterable>   
                    <!-- v-model => 产品 -->
                    <el-option v-for="(item,index) in productList" :value="item.Product_Code" :key="index" :label="item.Product_Name">
                    </el-option>
                  </el-select>
                </td>
                <td>
                  <el-input type="text" @blur="doToFixed(i,'IncomeMoney')" @keyup.native="onlyNumObjFn(i,'IncomeMoney')" @keydown.enter.native="addlist" v-model="i.IncomeMoney" class="formval-money full-box" :disabled="Type===2||Type===3" :placeholder="'请输入金额'"></el-input>
                  <!-- v-model => 金额 -->
                </td>
              </tr>
            </table>
            <div class="clearfloat">
              <div class="total-box">合计：<span class="Count-text">{{Count}}</span></div>
            </div>
          </div>
        </div>
      </div>
    </div>
    <!--
				打印窗口
        -->
    <el-dialog title="打印" :visible.sync="dialogPrintVisible" :modal-append-to-body="false">
          <div class="printBox cover">
            <el-button size="small" class="center" @click.native="printPdf()">&#12288;打印&#12288;</el-button>
            <div id="form1">
              <table width="100%" border="0"  v-loading="PrintLoading" element-loading-text="正在加载中">
              <caption>
                <h3 id="Doc">{{printsData.ER_Tite || ''}}</h3>
              </caption>
              <thead>
                <tr>
                    <td style="padding:15px 10px;line-height:30px;">
                      <div id="CompanyName" style="float:left">{{printsData.CompanyName || ''}}</div>
                      <div id="Current" style="float:right">打印日期：{{printsData.Current || ''}}</div>
                    </td>
                </tr>
              </thead>
              <tbody>
                <tr>
                  <td>
                    <div id="div" class="table-c">
                      <table cellpadding="3" width="100%" class="ListTable">
                        <tbody>
                          <tr>
                            <td class="tbTitle">单号</td>
                            <td class="Tabletd">{{printsData.entity ? printsData.entity.Income_DocNo : '' }}</td>
                            <td class="tbTitle">申请人</td>
                            <td class="Tabletd">{{printsData.entity ? printsData.entity.CreateByName : ''}}</td>
                            <td class="tbTitle">申请部门</td>
                            <td class="Tabletd">{{printsData.entity ? printsData.entity.CreateByDeptName : ''}}</td>
                          </tr>
                          <tr>
                            <td class="tbTitle">单据日期</td>
                            <td class="Tabletd">{{printsData.entity ? printsData.entity.Income_DocDateStr : ''}}</td>
                            <td class="tbTitle">客户</td>
                            <td class="Tabletd">{{printsData.entity ? printsData.entity.Income_CustomerName : ''}}</td>
                            <td class="tbTitle">收入金额</td>
                            <td class="Tabletd">{{printsData.entity && printsData.entity.Income_TotalIncomeMoney ? printsData.entity.Income_TotalIncomeMoney.toFixed(2) : '0.00'}}</td>
                          </tr>
                          <tr>
                            <td class="tbTitle">业务描述</td>
                            <td class="Tabletd" colspan="5">
                              {{printsData.entity ? printsData.entity.Income_Title : '' }}
                            </td>
                          </tr>
                        </tbody>
                      </table>
                    </div>
                  </td>
                </tr>
                <tr>
                  <td style="line-height:30px;">&nbsp;</td>
                </tr>
                <tr>
                  <td>
                    <div id="Line" class="table-c">
                      <table width="100%" class="ListTable">
                        <thead>
                          <tr>
                            <td width="5%">NO</td>
                            <td>产品</td>
                            <td>预算树</td>
                            <td>预算组织</td>
                            <td>月份</td>
                            <td>预算科目</td>
                            <td>收入金额</td>
                          </tr>
                        </thead>
                        <tbody>
                          <tr v-for="(p,index) in printsData.entity.IncomeLineSet" :key="index">
                            <td>{{index+1}}</td>
                            <td>{{p.ProductName ? p.ProductName : ''}}</td>
                            <td>{{p.YBDEntity && p.YBDEntity.YearBudgetName ? p.YBDEntity.YearBudgetName : ''}}</td>
                            <td>{{p.YBDEntity && p.YBDEntity.DepartmentName ? p.YBDEntity.DepartmentName : ''}}</td>
                            <td>{{p.YBDEntity && p.YBDEntity.Month ? p.YBDEntity.Month : ''}}</td>
                            <td>{{p.YBDEntity && p.YBDEntity.BudgetItemName ? p.YBDEntity.BudgetItemName : ''}}</td>                                                        
                            <td>{{p  && p.Money ? p.Money.toFixed(2)  : ''}}</td>                            
                          </tr>
                          <tr>
                            <td colspan="6">合计</td>
                            <td>{{printsData.entity && printsData.entity.IncomeLineSetMoney ? printsData.entity.IncomeLineSetMoney.toFixed(2):'0.00'}}</td>
                          </tr>
                        </tbody>
                      </table>
                    </div>
                  </td>
                </tr>
                <tr>
                  <td style="line-height:30px;">&nbsp;</td>
                </tr>
                <tr>
                  <td>
                    <div id="Line" class="table-c">
                      <table width="100%" class="ListTable">
                        <thead>
                          <tr>
                            <td width="5%">NO</td>
                            <td>处理人</td>
                            <td>处理结果</td>
                            <td>备注</td>
                            <td>处理日期</td>
                          </tr>
                        </thead>
                        <tbody>
                          <tr v-for="(p,index) in printsData.Chart" :key="index">
                            <td>{{index+1}}</td>
                            <td>{{p.PlanUser ? p.PlanUser : ''}}</td>
                            <td>{{p.StepName ? p.StepName : ''}}</td>
                            <td>{{p.OpRemark ? p.OpRemark : ''}}</td>
                            <td>{{p.OpDate ? p.OpDate : ''}}</td>
                          </tr>
                        </tbody>
                      </table>
                    </div>
                  </td>
                </tr>
                <tr>
                  <td>&nbsp;</td>
                </tr>
                <tr>
                  <!--审批流-->
                  <td>
                    <div id="Chart" class="table-c"></div>
                  </td>
                </tr>
              </tbody>
            </table>
            </div>
          </div>
    </el-dialog>
    <!--附件-->
    <el-dialog title="附件" :visible.sync="dialogUploadVisible" :modal-append-to-body="false" >
        <label for="file" v-if="Type!=2&&Type!=3" class="label-file"><i class="icon iconfont icon-shangchuan">&nbsp;</i>上传</label>
        <input name="file" id="file" type="file" accept="*" @change="update" multiple/>
        <div><br></div>
        <ul ref="images" style="display:none">
          <li v-for="(item, index) in UploadList" :key="index">
            <!-- <img :src="`http://192.168.1.188:8011/${item.Attachment_Url}`" :alt="item.Attachment_FileName"> -->
            <img :src="item.Attachment_Url" :alt="item.Attachment_FileName">
          </li>
        </ul>
        <el-table :data="UploadList" header-align="center" id="test">
          <el-table-column property="ID" label="ID" width="100"></el-table-column>
          <el-table-column property="Attachment_UploadDate" label="日期" :formatter="formatUploadDate"></el-table-column>
          <el-table-column property="Attachment_FileName" label="名称" show-overflow-tooltip></el-table-column>          
          <el-table-column label="操作" max-width="100">
            <template slot-scope="scope">
              <div style="display:inline-block;">
                <el-button v-if='isShowPreview(scope.row.Attachment_FileName)' type="info" size="small" @click="preview(scope)">
                  &#12288;<i class="el-icon-search"></i>预览&#12288;
                </el-button>
              </div>
              <a class="down" :href="scope.row.Attachment_Url" :download='scope.row.Attachment_FileName'>下载</a>
              <el-button v-if="Type!=2&&Type!=3" type="danger" size="small" @click="DeleUpload(scope.$index, scope.row)">&#12288;删除&#12288;</el-button>
            </template>
          </el-table-column>
        </el-table>
    </el-dialog>
    <!--查询-->
    <el-dialog title="查询" :visible.sync="dialogSearchVisible" :modal-append-to-body="false" size="tiny">
      <el-form :model="Searchform">
        <el-form-item label="金  额 ：" :label-width="formLabelWidth">
          <el-input v-model.number.trim="Searchform.StartMoney" auto-complete="off" style="width:120px;"></el-input>
          至&nbsp;<el-input v-model.number.trim="Searchform.EndMoney" auto-complete="off" style="width:120px;"></el-input>
        </el-form-item>
        <el-form-item label="日  期 ：" :label-width="formLabelWidth">
          <el-date-picker type="date" v-model="Searchform.StartDate" style="width:120px;" placeholder="选择日期"></el-date-picker>
          至&nbsp;<el-date-picker type="date" v-model="Searchform.EndDate" style="width:120px;" placeholder="选择日期"></el-date-picker>
        </el-form-item>
        <el-form-item label="单  号 ：" :label-width="formLabelWidth">
          <el-input v-model="Searchform.DocNo" style="width:262px;"></el-input>
        </el-form-item>
        <el-form-item label="标  题 ：" :label-width="formLabelWidth">
          <el-input v-model="Searchform.Title" style="width:262px;"></el-input>
        </el-form-item>
        <el-form-item label="客  户 ：" :label-width="formLabelWidth">
          <el-input v-model="Searchform.Name" style="width:262px;"></el-input>
        </el-form-item>
        <el-form-item label="状 态 ：" :label-width="formLabelWidth">
          <el-select v-model="Searchform.DocStatus" style="width:262px;" placeholder="请选择">
            <el-option value="" label="全部">全部</el-option>
            <el-option
              v-for="item in StatusOptions"
              :key="item.Code"
              :label="item.Name"
              :value="item.Code">
            </el-option>
          </el-select>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer cover">
        <el-button size="small" @click="Reset">重 置</el-button>
        <el-button size="small" @click="Query">确 定</el-button>
      </div>
    </el-dialog>
    <!-- 开具发票弹框 -->
    <el-dialog title="请选择税率" :visible.sync="dialogValueAddTaxVisible" @close="cancelValueAddTaxDial(valAddTaxCloseType)" :modal-append-to-body="false" align="center" size="tiny">
      <div v-if="valueAddTaxArr">
        <template>
          <el-radio v-for="(item,aIndex) in valueAddTaxArr.rows" v-model="valueAddTaxRadio" :label="item.AddedValueTax_Rate" :key="aIndex">{{item.AddedValueTax_Rate}}%</el-radio>
        </template>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button size="small" @click="cancelValueAddTaxDial(valAddTaxCloseType='cancel')">取 消</el-button>
        <el-button size="small" type="primary" @click="confirmValueAddTaxDial">确 定</el-button>
      </span>    
    </el-dialog>
    <!--里面流程图-->
    <el-dialog title="流程执行情况" :visible.sync="checkflowVisible" :modal-append-to-body="false" align="center">
      <el-table :data="docView" header-align="center" v-loading="docViewloading" element-loading-text="拼命刷新中...">
        <el-table-column property="PlanUser" label="操作人"></el-table-column>
        <el-table-column property="StepName" label="步骤名称"></el-table-column>
        <el-table-column property="OpDate" label="时间"></el-table-column>
        <el-table-column property="OpRemark" label="备注"></el-table-column>
      </el-table>
    </el-dialog> 
    </div>
</section>
</template>
<script>
import moment from 'moment';
/* function getQueryParam(name, url) {
  //URL GET 获取值
  var reg = new RegExp("(^|\\?|&)" + name + "=([^&]*)(\\s|&|$)", "i"),
    Url = url || location.href;
  if (reg.test(Url)) return decodeURI(RegExp.$2.replace(/\+/g, " "));
  return "";
} */
export default {
  name: "Income",
  data() {
    return {
      viewer: null, //viewer对象
      IncomeList: [], //列表数据
      showNum: "", //传过来的参数
      total: 0, //数据总数
      rows: 100, //每页显示多少条
      currentPage: 1,//当前页数
      key: "",
      dialogPrintVisible:false,//打印
      dialogSearchVisible:false,//查询
      formLabelWidth:'120px',
      isShowPayment: false, //预收款
      isAdvanceDetails: true, //预收明细      
      isSwitch: false,  //开关是否预收款      
      isshowAdd: false,
      isshowList: true,
      isshowEdit: false,
      loading: true,
      PrintLoading: true,//显示打印窗口loading
      UploadList: [], //附件列表数据
      isshowList: true,
      dialogPayVisible: false,
      dialogUploadVisible: false,//上传窗口
      docViewloading: false, //流程图
      checkflowRowVisible: false, //外面的流程图
      checkflowVisible: false, //里面的流程图
      dialogPeriodVisible: false,
      dialogCancelVisible: false,//取消
      PeriodList:[],//现金期间列表
      period:'',//现金期间model
      docView: [], //流程图列表
      docDate: '', //单据日期
      Customer: [], //客户
      SalesEmp: [], //业务员
      custom: [], //客户
      sales: "", //业务员
      TotalIncomeMoney: 0, //销售金额
      describe: "", //描述
      Type: 0,
      Msg: "", //审核提醒
      DocNo: "",
      Searchform: {
          StartMoney:"",
          EndMoney:"",
          StartDate:'',
          Name:'',
          EndDate:'',
          DocNo:'',
          Title:'',
          DocStatus:''
      },
      incomeDetail: [], //收入确认单 编辑时用
      payments: [],
      paymentsTemp: [],
      dialogPrintVisible:false,//打印
      paymentsPrint: [{
        Rcv_DocNO: '',
        Rcv_Title: '',
        Rcv_TotalRcvMoney: 0,
        Surplus: 0,
        Money: 0
      }],
      printsData: {
        entity: {
          BorrowLineSet: []
        }
      }, //打印的数据
      StatusOptions:[],
      budgetItemList: [], //收入类型
      baseDeptList: [], //部门
      productList: [], //产品
      detail: [{
        IncomeMoney: "", //金额
        Department: "", //部门
        BudgetItem: "", //类型
        Product: "", //产品
      }],
      filters: {
				name: ''
			},
      detailTemp: [],
      fullscreenLoading: false,
      //沟通模块
      dialogCommunicationVisible:false,//沟通窗口      
      CommunicationContentList:[],//沟通内容列表
      contentInput:'',//输入内容Model
      acquiescenceImg:'static/content/images/Header-S.png',//默认头像
      LaunchList:[],//沟通对象集合
      launch:[],//沟通对象
      launchChecked:false,//是否允许编辑
      requestEmp:'',//申请人ID
      communiTypes:0,//获取沟通状态
      isshowLauch:false,
      DocType:304,//单据类型 报销单=301 借款单=302  还款单=303 收入确认单=304  出纳付款=401  出纳收款=402
      mouse_enter_Rcv_DocNO:"",//鼠标移入当前行的单号
      isOpenBillSwitch:false,//开具发票显示隐藏
      dialogValueAddTaxVisible:false,//开具发票弹框显示隐藏
      valueAddTaxRadio:0,
      valueAddTaxArr:'',
      valAddTaxCloseType:'cancel',//判断关闭弹框的行为：cancel close
      communicateButtonDisabled:false,//沟通按钮是否置灰
      ListDoc:"",//编号
      fjBtnDisabled: true,//附件按钮置灰true
    };
  },
  methods: {
    openDialogPay(){
      if (this.Type===2||this.Type===3) {
        return
      }
      this.dialogPayVisible=true;
      if (this.paymentsPrint.length > 0) {
        // 取原列表数据
        const tempArr = JSON.parse(JSON.stringify(this.paymentsTemp)); //原数据
        // 将paymentsPrint 中金额不为0 的 数据对应 赋值给相应的
        for (let i = 0; i < tempArr.length; i++) {
          for (let t = 0; t < this.paymentsPrint.length; t++) {
            if (tempArr[i].ID == this.paymentsPrint[t].ID) {
              //如果循环的ID相同的话
              tempArr[i].Money = this.paymentsPrint[t].Money; //就赋值Money
            }
          }
        }
        this.paymentsTemp = tempArr; //paymentsTemp =>最终呈现在列表上的data
      }      
    },
    charge(){
      if(this.ListDoc==""){
        //alert('请选择收入确认单')
        this.$message({
          message: `请选择收入确认单`,
          type: 'warning',
          offset: 200,
          duration: 1800
        });        
      }else{
        this.$confirm('确认红字冲销吗？', '提示', {}).then(() => {
          let para = {ListDoc:this.ListDoc}
          axios.get("writeOff", para).then((res) => {
            console.log(res);                
            if (!res.Success) {
              this.$message({
                message: res.Message,
                type: 'warning',
                offset: 200,
                duration: 1800
              });
                return;
              }
              this.$message({
                message: `编号` + para.ListDoc + ` 修改成功！！`,
                type: 'success',
                offset: 200,
                duration: 1800
              });
                // this.$refs['ListDoc'].resetFields();
                // this.editFormVisible = false;
                this.getList();
          });
        });
      }
    },
    add(){
     this.ListDoc = arguments[0].Income_DocNo;
      //console.log(this.ListDoc);
    },
    confirmValueAddTaxDial(){//确认开具发票
      // console.log("确认开具发票")
      // console.log(this.valueAddTaxRadio==='',"valueAddTaxRadio")
      if (this.valueAddTaxRadio===0) {
        this.$message({
          message: '请选择税率',
          type: 'warning',
          duration: 1200
        });
      }else{
        //关闭弹框
        this.valAddTaxCloseType='confirm'
        this.dialogValueAddTaxVisible=false
      }
    },
    cancelValueAddTaxDial(type){//取消开具发票弹框
      // console.log("取消弹框",type)
      if (type==='cancel') {
        this.isOpenBillSwitch=false;
        this.valueAddTaxRadio=0;  
      }
      // if (type==='confirm') {}
      this.dialogValueAddTaxVisible=false;
    },
    async getValueAddTaxFn(bool){
      this.valueAddTaxArr=await axios.get('getValueAddJson');
      console.log(this.valueAddTaxArr)
      if(this.valueAddTaxArr.rows.length==1){
        this.valueAddTaxRadio=this.valueAddTaxArr.rows[0].AddedValueTax_Rate
        return
      }
      this.dialogValueAddTaxVisible=bool
      if(this.dialogValueAddTaxVisible){
        this.valueAddTaxRadio=0;
      }
      this.valueAddTaxArr.rows.sort((a,b)=>a.AddedValueTax_Rate-b.AddedValueTax_Rate)
    },
    showValueAddTaxChange(bool){
      // this.dialogValueAddTaxVisible=bool
      // if(this.dialogValueAddTaxVisible){
      //   this.valueAddTaxRadio=0;
      //   this.getValueAddTaxFn();
      // }
      //只有一个值，不打开弹框
      if(!bool){
        this.valueAddTaxRadio=0;
        return
      }
      this.getValueAddTaxFn(bool);
    },
    changeMoneyToZero(obj){//预收明细操作删除，改变operaPrint，并且改变弹框数据;如果表格行数为零，隐藏表格
      // console.log(obj.row.Rcv_DocNO,"obj.row.Rcv_DocNO")
      // console.log(this.paymentsTemp,"paymentsTemp上面")
      // console.log(this.paymentsPrint,"paymentsPrint当前")
      // console.log(this.detail,"detail下面")
      let dele_Rcv_DocNO=obj.row.Rcv_DocNO;
      //console.log(dele_Rcv_DocNO,"dele_Rcv_DocNO")
      this.paymentsPrint.splice(obj.$index,1);
      if (this.paymentsPrint.length==0) {//预收明细表格数组为空，关闭
        this.isSwitch=false;
        this.isShowPayment=false
      }
      this.paymentsTemp.forEach(item=>{
        if (item.Rcv_DocNO==dele_Rcv_DocNO) {
          item.Money=""
        }
      })
      if(this.Type===0){
        this.detail=this.detail.filter(item=>{
          let arr=item.DocNo.split(",");
          if (arr.findIndex(item=>item===dele_Rcv_DocNO)==-1) {
            return item
          }
        })
      }
      if(this.Type===1){
        this.detail=this.detail.filter(item=>{
          let arr=item.IncomeLine_RcvDoc.split(",");
          if (arr.findIndex(item=>item===dele_Rcv_DocNO)==-1) {
            return item
          }
        })
      }
      if (this.detail.length==0) {
        this.addlist()
      }
    },
    cellMouseEnterTwoFn(...arr){
      this.mouse_enter_Rcv_DocNO=arr[0].Income_DocNo
    },    
    cellMouseEnterFn(...arr){//鼠标移速单元格触发事件
      this.mouse_enter_Rcv_DocNO=arr[0].Rcv_DocNO
    },
    cellMouseLeaveFn(){
      this.mouse_enter_Rcv_DocNO=""
    },    
    formatDate(row, column) {
      if (row.Income_DocDate) {
        //如果日期存在的 才格式化
        return row.Income_DocDate.split("T", 1);
      } else "";
    },
    formatUploadDate(row, column) {
      return row.Attachment_UploadDate.split("T", 1);
    },
    changePage(page) {//当前页数
      this.currentPage = page;
      this.getList();
    },
    search(){
      this.dialogSearchVisible = true;
      this.getStatusList();
    },
    async getStatusList(){
      this.StatusOptions = await axios.get('getStatusList');
    },
    async getList() {
      this.loading = true;
      const res =  await axios.get("getIncomeList", {
          page: this.currentPage,
          rows: this.rows, //显示100条
      })
      this.total = res.total;//总页数
      this.IncomeList = res.rows;
      console.log(this.IncomeList);
      this.loading = false;
    },
    /*
     *  查询 
     */
    async Query(){
      if(new Date(this.Searchform.StartDate)>new Date(this.Searchform.EndDate)){
        console.log(new Date(this.Searchform.StartDate),'this.Searchform.StartDate')
        console.log(new Date(this.Searchform.EndDate),'this.Searchform.EndDate')
        this.$message({
          message: '开始日期必须小于或者等于结束时期！',
          type: 'warning',
          duration: 1200
        });
        return;
      }else if(this.Searchform.StartMoney>this.Searchform.EndMoney){
        this.$message({
          message: '开始金额必须小于或者等于结束金额！',
          type: 'warning',
          duration: 1200
        });
        return;
      }
      this.dialogSearchVisible = false;
      console.log(this.Searchform.StartDate ? moment(this.Searchform.StartDate).format('L') : '','1');
      console.log(this.Searchform.EndDate ? moment(this.Searchform.EndDate).add(1,"d").format('L') : '','2');
      let filterName = {
        "groupOp": "AND",
        "rules": [{
          "field": "Income_DocNo",
          "dataType": "string",
          "op": "cn",
          "data": this.Searchform.DocNo || ''
        }, {
          "field": "Income_Title",
          "dataType": "string",
          "op": "cn",
          "data": this.Searchform.Title || ''
        },{
          "field": "Income_DocStatus",
          "dataType": "numeric",
          "op": "eq",
          "data": this.Searchform.DocStatus || ''
        },{
          "field": "Custom_Name",
          "dataType": "string",
          "op": "cn",
          "data": this.Searchform.Name || ''
        }, {
          "field": "Income_TotalIncomeMoney",
          "dataType": "numeric",
          "op": "ge",
          "data": this.Searchform.StartMoney || ''
        }, {
          "field": "Income_TotalIncomeMoney",
          "dataType": "numeric",
          "op": "le",
          "data": this.Searchform.EndMoney || ''
        }, {
          "field": "Income_DocDate",
          "dataType": "string",
          "op": "ge",
          "data": this.Searchform.StartDate ? moment(this.Searchform.StartDate).format('L') : ''
        }, {
          "field": "Income_DocDate",
          "dataType": "string",
          "op": "le",
          "data": this.Searchform.EndDate ? moment(this.Searchform.EndDate).add(1,"d").format('L') : ''
        }],
        "groups": []
      }
      this.loading = true;
      const res = await axios.post("getIncomeList", { 
        filter:JSON.stringify(filterName),
        page:this.currentPage,
        rows:this.rows,
      });
      this.total = res.total;//总页数
      this.IncomeList = res.rows;
      this.loading = false;
    },
    Reset(){
      this.Searchform = {
          StartMoney:"",
          EndMoney:"",
          StartDate:'',
          EndDate:'',
          Name:'',
          DocNo:'',
          Title:'',
          DocStatus:''
      }
    },
    /**
     *  显示新增界面	
     */
    handleAdd() {
      this.isshowAdd = true; //新建页面显示
      this.isshowList = false; //列表页面隐藏
      this.isshowEdit = false;
      this.isSwitch = false;
      this.isShowPayment = false;
      this.isAdvanceDetails = true;
      this.isOpenBillSwitch=false;//关闭开具发票
      this.valueAddTaxRadio=0;
      /* this.getCustomer(); */
      this.getSales();
      this.getIncomeBudget();
      /**
       * 打开新增页面时顺便清空下数据
       */
      this.describe = ''; //描述
      this.custom = [], //客户
      this.Customer = [];//清空远程客户输入框
      this.sales = '', //业务员
      this.TotalIncomeMoney = '', //销售金额
      this.DocNo = '';
      this.detail = [{
        IncomeMoney: "", //金额
        Department: "", //部门
        BudgetItem: "", //类型
        Product: "", //产品
      }],
      this.paymentsPrint = [],
      this.docDate = new Date(); //日期
    },
    /**
     * 显示编辑界面
     */
    // handleEdit(index,row) {
    handleEdit(...rest) {
      let row=rest[0];       
      if (!row) {
        this.showNum = this.$route.query.showNum;
        this.DocNo = this.$route.query.key;
      } else {
        this.DocNo = row.Income_DocNo;
      }
      this.isshowAdd = false; //新增隐藏
      this.isshowList = false; //列表隐藏
      this.isshowEdit = true; //编辑显示
      this.isOpenBillSwitch=false;//关闭开具发票  
      this.valueAddTaxRadio=0;  
      let all = [
        //获取收入确认单详细信息
        axios
        .get("IncomeDetail", {
          key: this.DocNo //单据编号
        }),
        //获得预算明细
        axios
        .get("getIncomeLine", {
          key: this.DocNo
        })
      ];
      this.axios.all(all).then(
        this.axios.spread((res1,res3) => {
          this.Type = res1.Type; //0添加  1修改 2查看  3有审核权限  
          this.incomeDetail = res1.entity; //收入确认单详细信息
          console.log(this.incomeDetail,"incomeDetail")
          const {Income_Customer: AI_Code, CustomerName: AI_Name} = res1.entity;
          this.Customer.push({AI_Code, AI_Name});
          this.communiTypes = res1.AllowCommunication;//获得沟通对象
          this.valueAddTaxRadio=res1.entity.Invoice_TaxRatio;//发票税率
          //this.fjBtnDisabled = res1.FJNum==0?true:false;
          if (this.Type==1) {//修改状态附件按键亮起
            this.fjBtnDisabled=false;
          }else{//查看和待审核状态，有附件数才亮起
            this.fjBtnDisabled = res1.FJNum==0?true:false;
          }
          //console.log(this.valueAddTaxRadio,"valueAddTaxRadio")
          if (this.valueAddTaxRadio!==0) {//增值税
            this.isOpenBillSwitch=true
          }else{
            this.isOpenBillSwitch=false
          }
          this.isSwitch = this.incomeDetail.Income_IncomeType === 0 ? false:true;//是否勾上
          //console.log(this.isSwitch,'是否勾上');
          // if (this.isSwitch) {
          //   this.isShowPayment = this.isSwitch; 
          // }
          this.isShowPayment = this.isSwitch; 
          this.docDate = this.incomeDetail.Income_DocDate; //单据日期
          this.custom = this.incomeDetail.Income_Customer; //客户
          this.sales = this.incomeDetail.Income_SalesEmp; //业务员
          this.TotalIncomeMoney = this.incomeDetail.Income_TotalIncomeMoney; //销售金额
          this.describe = this.incomeDetail.Income_Title; //描述
          this.getSales();
          this.detailTemp = res3;
          this.detail.length = 0;
          //方法1
          /* let obj = {IncomeMoney: "",Department: "",BudgetItem: "",Product: ""}
          for(let i=0;i < this.detailTemp.length;i++){
            obj.IncomeMoney = this.detailTemp[i].IncomeLine_IncomeMoney;
            obj.Department = this.detailTemp[i].YBL_Department;
            obj.BudgetItem = this.detailTemp[i].YBL_BudgetItem;
            obj.Product = this.detailTemp[i].IncomeLine_Product;
          }
          this.detail.push(obj)  */
          /* alert(this.custom,'this.custom');
          alert(this.Type,'this.Type');
          alert(this.DocNo,'this.DocNo');
          axios.get("getPayment", {
            Customer: this.custom, //客户编号
            Type: this.Type, //0是新建
            key: this.DocNo //单据编号
          }).then(res=>{
            this.paymentsPrint = res;
            this.paymentsPrint.forEach(item => {
              item.Rcv_TotalRcvMoney = item.Rcv_TotalRcvMoney === 0 ? "" : item.Rcv_TotalRcvMoney;
              item.Surplus = item.Surplus === 0 ? "" : item.Surplus;
              item.Money = item.Money === 0 ? "" : item.Money;
            })
          }).catch(err=>{
            console.log(err);
          }); */
          this.getPayMent();
          //方法2
          // console.log(this.paymentsPrint,"paymentsPrint")
          // console.log(res3,"res3")
          for (let i = 0; i < this.detailTemp.length; i++) {
            this.detail.push({
              IncomeLine_RcvDoc:this.detailTemp[i].IncomeLine_RcvDoc,
              IncomeMoney: this.detailTemp[i].IncomeLine_IncomeMoney,
              Department: this.detailTemp[i].YBL_Department,
              BudgetItem: this.detailTemp[i].YBL_BudgetItem,
              Product: this.detailTemp[i].IncomeLine_Product
            })
          }
          console.log(this.detail,"detail")
          this.getIncomeBudget();
          // if(this.communiTypes==1||this.communiTypes==2){ //判断状态获取沟通
          //   this.dialogCommunicationVisible = true;
          //   this.isshowLauch = false;
          //   let all = [
          //     axios.get('CommunicationContent',{
          //       key:this.DocNo,
          //       DocType:this.DocType
          //     }),
          //     axios.get('LaunchList',{
          //       key:this.DocNo,
          //       DocType:this.DocType
          //     }),
          //   ];
          //   this.axios.all(all).then(
          //     this.axios.spread((res1,res2)=>{
          //       this.CommunicationContentList = res1;//获得沟通内容
          //         for(var i=0;i<this.CommunicationContentList.length;i++){
          //           if(this.CommunicationContentList[i].Img==''){//如果是空的
          //             const ac = this.acquiescenceImg;
          //             this.CommunicationContentList[i].Img = ac;//赋值默认头像
          //           }
          //         }
          //         this.requestEmp = res2.RequestEmp;//申请人ID
          //         this.LaunchList = res2.us;//获得沟通对象  
          //     })
          //   )   
          // }
          let This=this;
          this.getMayHaveCommunicationFn({key:This.DocNo,DocType:This.DocType,type:this.Type}).then(res=>{//是否有沟通
            This.communicateButtonDisabled=false
            if(This.communiTypes==1||This.communiTypes==2){ //判断状态获取沟通
              This.dialogCommunicationVisible = true;
              This.isshowLauch = false;
              let all = [
                axios.get('CommunicationContent',{
                  key:This.DocNo,
                  DocType:This.DocType
                }),
                axios.get('LaunchList',{
                  key:This.DocNo,
                  DocType:This.DocType
                }),
              ];
              This.axios.all(all).then(
                This.axios.spread((res1,res2)=>{
                  This.CommunicationContentList = res1;//获得沟通内容
                    for(var i=0;i<This.CommunicationContentList.length;i++){
                      if(This.CommunicationContentList[i].Img==''){//如果是空的
                        const ac = This.acquiescenceImg;
                        This.CommunicationContentList[i].Img = ac;//赋值默认头像
                      }
                    }
                    This.requestEmp = res2.RequestEmp;//申请人ID
                    This.LaunchList = res2.us;//获得沟通对象  
                })
              )   
            }
          }).catch(()=>{
            This.communicateButtonDisabled=true
          })
        })
      )
    },
    //获得预收款
   async getPayMent(){
      const res = await axios.get("getPayment", {
          Customer: this.custom, //客户编号
          Type: this.Type, //0是新建
          key: this.DocNo //单据编号
      });
      this.payments = res;
      this.paymentsTemp = res;
      this.paymentsPrint = res;
      this.paymentsTemp.forEach(item => {
        item.Rcv_TotalRcvMoney = item.Rcv_TotalRcvMoney === 0 ? "" : item.Rcv_TotalRcvMoney;
        item.Surplus = item.Surplus === 0 ? "" : item.Surplus;
        item.Money = item.Money === 0 ? "" : item.Money;
      })
      
      this.paymentsPrint.forEach(item => {
        item.Rcv_TotalRcvMoney = item.Rcv_TotalRcvMoney === 0 ? "" : item.Rcv_TotalRcvMoney;
        item.Surplus = item.Surplus === 0 ? "" : item.Surplus;
        item.Money = item.Money === 0 ? "" : item.Money;
      })
      this.paymentsPrint = this.paymentsPrint.filter(item => {
        if(item.Money) {
          item.Money = Number(item.Money).toFixed(2)
          return item;
        }
      })
      console.log(this.paymentsPrint,'this.paymentsPrint');
    },
    /**
     * 新增-提交
     */
    addSubmit() {
      let printArr = [];
      let paymentsPrint = this.paymentsPrint;
      paymentsPrint.forEach(value => {
        let money = value.Money; //金额
        let id = value.Rcv_DocNO; //ID
        let temp = `{"je":${money},"ID":"${id}"}`;
        printArr.push(temp);
      })
      let rcv = printArr.join(","); //逗号分割并拼接备份给json字符串传参
      rcv = `[` + rcv + `]`;

      let budgetArr = [];
      this.detail=this.detail.filter(item=>item.IncomeMoney||item.Department||item.Product||item.BudgetItem)
      if (this.detail.length==0) {
        this.addlist()
      }
      let detail = this.detail;
      detail.forEach(value => {
        let money = value.IncomeMoney; //金额
        let depart = value.Department; //部门
        let product = value.Product; //产品
        let budget = value.BudgetItem; //收入类型
        let RcvDoc = value.DocNo;
        console.log(budget);
        let temp2 = `{"Money":${money},"Dept":"${depart}","Budget":"${budget}","Product":"${product}","IncomeLine_RcvDoc":"${RcvDoc}"}`;
        budgetArr.push(temp2);
      });
      let IncomeLine = budgetArr.join(",");
      IncomeLine = `[` + IncomeLine + `]`;

      let params = {
        Income_DocStatus: 2, //2是提交
        key: null,
        Income_DocDate: this.docDate,
        Income_Customer: this.custom,
        Income_SalesEmp: this.sales,
        Income_TotalIncomeMoney: this.TotalIncomeMoney,
        Income_Title: this.describe,
        Income_IncomeType: this.isShowPayment == true ? 2 : 0,
        IncomeLine: IncomeLine,
        Rcv: rcv,
        key: this.DocNo,
        Invoice_TaxRatio:this.valueAddTaxRadio
      }
      axios.post('addSubmitIncome', params)
        .then(res => {
          if (res.Success == true) {
            this.$message({
              message: `提交成功`,
              type: "success",
              duration:1200
            });
            this.isshowEdit = false;
            this.isshowAdd = false;
            this.isshowList = true;
            this.getList();
          } else {
            this.$message({
              message: res.Message,
              type: "warning",
              duration: 1500
            });
          }
        })
        .catch(err => {
          console.log(err);
        });
    },
    /**
     * 新增-保存
     */
    addSave() {
      let printArr = [];
      let paymentsPrint = this.paymentsPrint;
      paymentsPrint.forEach(value => {
        let money = value.Money; //金额
        let id = value.Rcv_DocNO; //ID
        let temp = `{"je":${money},"ID":"${id}"}`;
        printArr.push(temp);
      })
      let rcv = printArr.join(","); //逗号分割并拼接备份给json字符串传参
      rcv = `[` + rcv + `]`;

      let budgetArr = [];
      this.detail=this.detail.filter(item=>item.IncomeMoney||item.Department||item.Product||item.BudgetItem);
      if (this.detail.length==0) {
        this.addlist()
      }
      // console.log(this.detail,"detail")
      let detail = this.detail;
      detail.forEach(value => {
        let money = value.IncomeMoney; //金额
        let depart = value.Department; //部门
        let product = value.Product; //产品
        let budget = value.BudgetItem; //收入类型
        let RcvDoc = value.DocNo;
        let temp2 = `{"Money":${money},"Dept":"${depart}","Budget":"${budget}","Product":"${product}","IncomeLine_RcvDoc":"${RcvDoc}"}`;
        budgetArr.push(temp2);
      });
      let IncomeLine = budgetArr.join(",");
      IncomeLine = `[` + IncomeLine + `]`;
      let params = {
        Income_DocStatus: 1, //1是保存
        key: null,
        Income_DocDate: this.docDate,
        Income_Customer: this.custom,
        Income_SalesEmp: this.sales,
        Income_TotalIncomeMoney: this.TotalIncomeMoney,
        Income_Title: this.describe,
        Income_IncomeType: this.isShowPayment == true ? 2 : 0,
        IncomeLine: IncomeLine,
        Rcv: rcv,
        key: this.DocNo,
        Invoice_TaxRatio:this.valueAddTaxRadio////增值税税率
      }
      axios.post('addSubmitIncome', params)
        .then(res => {
          if (res.Success == true) {
            this.$message({
              message: `保存成功`,
              type: "success",
              duration: 1200
            });
            if(res.data.DocNO){
              this.DocNo = res.data.DocNO;
            }
            this.getList();
          } else {
            this.$message({
              message: res.Message,
              type: "warning",
              duration: 1500
            });
          }
        })
        .catch(err => {
          console.log(err);
        });
    },
    /** 
     * 编辑-保存
     */
    editSave() {
      let printArr = [];
      let paymentsPrint = this.paymentsPrint;
      paymentsPrint.forEach(value => {
        let money = value.Money; //金额
        let id = value.Rcv_DocNO; //ID
        let temp = `{"je":${money},"ID":"${id}"}`;
        printArr.push(temp);
      })
      let rcv = printArr.join(","); //逗号分割并拼接备份给json字符串传参
      rcv = `[` + rcv + `]`;

      let budgetArr = [];
      this.detail=this.detail.filter(item=>item.IncomeMoney||item.Department||item.Product||item.BudgetItem)
      if (this.detail.length==0) {
        this.addlist()
      }
      let detail = this.detail;
      detail.forEach(value => {
        let money = value.IncomeMoney; //金额
        let depart = value.Department; //部门
        let product = value.Product; //产品
        let budget = value.BudgetItem; //收入类型
        let RcvDoc = value.DocNo;
        let temp2 = `{"Money":${money},"Dept":"${depart}","Budget":"${budget}","Product":"${product}","IncomeLine_RcvDoc":"${RcvDoc}"}`;
        budgetArr.push(temp2);
      });
      let IncomeLine = budgetArr.join(",");
      IncomeLine = `[` + IncomeLine + `]`;
      let params = {
        Income_DocStatus: 1, //1是保存
        key: this.DocNo,
        Income_DocDate: this.docDate,
        Income_Customer: this.custom,
        Income_SalesEmp: this.sales,
        Income_TotalIncomeMoney: this.TotalIncomeMoney,
        Income_Title: this.describe,
        Income_IncomeType: this.isShowPayment == true ? 2 : 0,
        IncomeLine: IncomeLine,
        Rcv: rcv,
        Invoice_TaxRatio:this.valueAddTaxRadio
      }
      axios.post('editSubmitIncome', params)
        .then(res => {
          if (res.Success == true) {
            this.$message({
              message: res.Message,
              type: "success",
              duration:1200
            });
            /* this.paymentsPrint.length = 0; */
          } else {
            this.$message({
              message: res.Message,
              type: "warning",
              duration: 1500
            });
          }
        })
        .catch(err => {
          console.log(err);
        });
    },
    /**
     * 沟通编辑-提交
     */
    SubmitForm() {
      let printArr = [];
      let paymentsPrint = this.paymentsPrint;
      paymentsPrint.forEach(value => {
        let money = value.Money; //金额
        let id = value.Rcv_DocNO; //ID
        let temp = `{"je":${money},"ID":"${id}"}`;
        printArr.push(temp);
      })
      let rcv = printArr.join(","); //逗号分割并拼接备份给json字符串传参
      rcv = `[` + rcv + `]`;

      let budgetArr = [];
      this.detail=this.detail.filter(item=>item.IncomeMoney||item.Department||item.Product||item.BudgetItem);
      if (this.detail.length==0) {
        this.addlist()
      }
      let detail = this.detail;
      detail.forEach(value => {
        let money = value.IncomeMoney; //金额
        let depart = value.Department; //部门
        let product = value.Product; //产品
        let budget = value.BudgetItem; //收入类型
        let RcvDoc = value.DocNo;
        let temp2 = `{"Money":${money},"Dept":"${depart}","Budget":"${budget}","Product":"${product}","IncomeLine_RcvDoc":"${RcvDoc}"}`;
        budgetArr.push(temp2);
      });
      let IncomeLine = budgetArr.join(",");
      IncomeLine = `[` + IncomeLine + `]`;
      let params = {
        Income_DocStatus: 2, //1是保存
        key: this.DocNo,
        Income_DocDate: this.docDate,
        Income_Customer: this.custom,
        Income_SalesEmp: this.sales,
        Income_TotalIncomeMoney: this.TotalIncomeMoney,
        Income_Title: this.describe,
        Income_IncomeType: this.isShowPayment == true ? 2 : 0,
        IncomeLine: IncomeLine,
        Rcv: rcv,
        Invoice_TaxRatio:this.valueAddTaxRadio
      }
      axios.post('editSubmitIncome', params)
        .then(res => {
          if (res.Success == true) {
            this.$message({
              message: res.Message,
              type: "success",
              duration:1200              
            });
            this.isshowAdd = false;
            this.isshowEdit = false;
            this.isshowList = true;
            this.getList();
          } else {
            this.$message({
              message: res.Message,
              type: "warning",
              duration:1500              
            });
          }
        })
        .catch(err => {
          console.log(err);
        });
    },
    validationFn(){//验证提交表格是否出错
      let printArr = [];
      let paymentsPrint = this.paymentsPrint;
      paymentsPrint.forEach(value => {
        let money = value.Money; //金额
        let id = value.Rcv_DocNO; //ID
        let temp = `{"je":${money},"ID":"${id}"}`;
        printArr.push(temp);
      })
      let rcv = printArr.join(","); //逗号分割并拼接备份给json字符串传参
      rcv = `[` + rcv + `]`;

      let budgetArr = [];
      this.detail=this.detail.filter(item=>item.IncomeMoney||item.Department||item.Product||item.BudgetItem);
      if (this.detail.length==0) {
        this.addlist()
      }
      let detail = this.detail;
      detail.forEach(value => {
        let money = value.IncomeMoney; //金额
        let depart = value.Department; //部门
        let product = value.Product; //产品
        let budget = value.BudgetItem; //收入类型
        let RcvDoc = value.DocNo;
        let temp2 = `{"Money":${money},"Dept":"${depart}","Budget":"${budget}","Product":"${product}","IncomeLine_RcvDoc":"${RcvDoc}"}`;
        budgetArr.push(temp2);
      });
      let IncomeLine = budgetArr.join(",");
      IncomeLine = `[` + IncomeLine + `]`;
      let params = {
        Income_DocStatus: 2, //1是保存
        key: this.DocNo,
        Income_DocDate: this.docDate,
        Income_Customer: this.custom,
        Income_SalesEmp: this.sales,
        Income_TotalIncomeMoney: this.TotalIncomeMoney,
        Income_Title: this.describe,
        Income_IncomeType: this.isShowPayment == true ? 2 : 0,
        IncomeLine: IncomeLine,
        Rcv: rcv,
        Invoice_TaxRatio:this.valueAddTaxRadio
      }
      let That=this;
      return new Promise(function(resolve,reject){
        axios.get('ysIncomeVerification', params).then(res=>{
          if (res.Success == true) {
            resolve()
          } else {
            That.$message({
              message: res.Message,
              type: "warning",
              duration:1500              
            });
          }
        }).catch(err=>{
          console.log(err,"err")
        });
      })

    },
    // editSubmit(){
    //   this.getState();
    //   if(this.communiTypes===2){ 
    //     this.isshowLauch = true;
    //     this.dialogCommunicationVisible = true;
    //   } else {
    //     this.SubmitForm();
    //   } 
    // },    
    editSubmit(){//改版
      this.validationFn().then(res=>{
        this.getState();
        if(this.communiTypes===2){ 
          this.isshowLauch = true;
          this.dialogCommunicationVisible = true;
        } else {
          this.SubmitForm();
        }
      })
    },
    getPaymentAddDiaLog() {
      console.log("Type===2||Type===3")
      if(this.paymentsPrint.length<=0){
        axios
          .get("getPayment", {
            Customer: this.custom, //客户编号
            Type: 0, //0是新建
            key: null, //单据编号
          })
          .then(res => {
            console.log(res, 'res');
            this.payments = res;
            this.paymentsTemp = res;
            this.paymentsTemp.forEach(item => {
              item.Rcv_TotalRcvMoney = item.Rcv_TotalRcvMoney === 0 ? "" : item.Rcv_TotalRcvMoney;
              item.Surplus = item.Surplus === 0 ? "" : item.Surplus;
              item.Money = item.Money === 0 ? "" : item.Money;
            })
          }).catch(err => {
            console.log(err);
          })
      }
      this.dialogPayVisible = true;
    },
    async confirm() {
      //console.log(this.detail,"this.detail")
      //打印到备用数组上
      this.paymentsPrint = [];
      // const tempArr = this.paymentsTemp; //paymentsTemp =>最终呈现在列表上的data
      const tempArr = JSON.parse(JSON.stringify(this.paymentsTemp));

      this.paymentsPrint = tempArr.filter(item => item.Money > 0.005);
      const res = await axios.get('getRcvLine',{keys:this.paymentsPrint.map(item => item.Rcv_DocNO).join(',')});
      var temp = [];
      for(let i of res){
        var IncomeMoney = 0;
        var Department = i.YBL_Department;
        var BudgetItem = i.YBL_BudgetItem;
        var Product = ""; 

        for(let v of this.detail){ 
          console.log('v',v); 
          console.log('i',i); 
          if(v.YBLID == i.YBLID  && v.DocNo != "" && IncomeMoney == ""){
            Department = v.Department;
            BudgetItem = v.BudgetItem;
            Product = v.Product;
            IncomeMoney = v.IncomeMoney;
          }
        }
          
        temp.push({
          DocNo: i.DocNos,
          YBLID:i.YBLID,
          IncomeMoney: IncomeMoney, //金额
          Department: Department, //部门
          BudgetItem: BudgetItem, //类型
          Product: Product, //产品
        });
      }
      //删除原先除了自己添加的数据
      for(var i = 0; i < this.detail.length; i++){
        if(this.detail[i].DocNo!=""){
          this.detail.splice(i,1);
          i--;
        }
      } 
      //添加新数据
      for(let i of temp){
        this.detail.push({
          DocNo: i.DocNo,
          // IncomeMoney: i.IncomeMoney, //金额
          IncomeMoney: '',
          Department: i.Department, //部门
          BudgetItem: i.BudgetItem, //类型
          // BudgetItem: '',
          Product: i.Product, //产品
          YBLID:i.YBLID,
        }); 
      }
      //清除空行
      //this.detail=this.detail.filter(item=>(item.YBLID||item.DocNo||item.IncomeMoney||item.Department||item.BudgetItem||item.Product))
      this.detail=this.detail.filter(item=>{
        for(var attr in item){
          if(item[attr]){
            return item
            continue
          }
        }
      })
      this.paymentsPrint = tempArr.filter(item => {
        if(item.Money) {
          item.Money = Number(item.Money).toFixed(2)
          return item;
        }
      })
      this.dialogPayVisible = false; //关闭弹窗
    },
    cancel() {
      // console.log("cancel")
      //取消按钮 关闭窗口
      this.dialogPayVisible = false;
      //关闭弹框时，如果预收明细表格为空，就收起预收明细
      if (this.paymentsPrint.length==0) {
        this.isSwitch=false;
        this.isShowPayment=false
      }
      //点击取消，上面表格数组过滤
      this.paymentsTemp.forEach(aItem=>{
        if(this.paymentsPrint.findIndex(bItem=>bItem.Rcv_DocNO==aItem.Rcv_DocNO)==-1){
          aItem.Money=""
        }
      })      
    },
    // 明细部分删除按钮
    handleDelete(index) {
      this.$confirm("确认删除该记录吗?", "提示", {
        type: "warning"
      }).then(() => {
        this.detail.splice(index, 1);
        this.$message({
          message: "已删除",
          type: "success"
        });
        if (this.detail.length==0) {//默认留一空行
          this.addlist()
        }
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '已取消'
        });           
      });
    },
    //打印窗口
    async getPrint(){
      this.dialogPrintVisible = true;
      this.PrintLoading = true;
      const res = await axios.get("Print",{DocNo:this.DocNo,DocType: this.DocType});
      this.printsData = res;
      this.PrintLoading = false;      
    },
    /**
     * 获得业务员
     */
    async getSales() {
      this.SalesEmp = await axios.get('getEmployee');
    },
    //获得部门和收入类型和产品
    async getIncomeBudget() {
      const res = await axios.get('getIncomeBudget');
      this.budgetItemList = res.Base_BudgetItem; //收入类型
      this.baseDeptList = res.Base_Dept; //部门
      this.productList = res.Product; //产品
    },
    // 新建返回到列表页面
    addToBack() {
      this.isshowAdd = false; //新建页面隐藏
      this.isshowList = true; //列表页面显示
      this.getList();
    },
    // 编辑页面显隐
    editToBack() {
      this.isshowEdit = false; //编辑页面隐藏
      this.isshowList = true; //列表页面显示
      this.getList();
    },
    //预算明细添加行
    addlist() {
      this.detail.push({
        YBLID:"",
        DocNo:"",
        IncomeMoney: "", //金额
        Department: "", //部门
        BudgetItem: "", //类型
        Product: "", //产品
      });
    },
    //删除
    async handleDel(index, row) {
      // 这种两个 Promise 嵌套的情况也可以改
      // 注意第一个 then 没有参数，也就是说不需要参数
      // 这样直接用一个 await 就行了，不用再赋值
      await this.$confirm('确认删除该记录吗？', '提示', {type: 'warning'});
      // 这里可以用一个解构赋值
      const {Success, Message} = await axios.post('deleIncome', {
        key: row.Income_DocNo
      }); 
      if (!Success) {
        this.$message({
          message: Message,
          type: "warning"
        });
      } else {
        this.$message({
          message: Message,
          type: "success"
        });
        this.getList();
      }
    },
    /**
     * 外面的流程图
     */
    checkflowRow(index, rows) {
      this.checkflowRowVisible = true;
      let DocNO = rows.Income_DocNo;
      if (this.checkflowRowVisible == true) {
        if (rows.DocStatus == "新建") {
          //如果是新建状态就直接给个提示
          this.checkflowRowVisible = false;
          this.$message({
            message: "新建状态未有流程图",
            type: "warning"
          });
        } else if (rows.DocStatus == "无效") {
          //如果是无效状态也直接给个提示
          this.checkflowRowVisible = false;
          this.$message({
            message: "未找到相对应的流程图",
            type: "warning"
          });
        } else {
          //否则直接请求拿列表数据
          this.docViewloading = true;
          axios
            .get("checkFlow", {
              DocNo: DocNO, //单据编号
              DocType: 304 //类型为收入确认单
            })
            .then(res => {
              this.docView = res;
              this.docViewloading = false;
            })
            .catch(err => {
              console.log(err);
            });
        }
      }
    },
        /*
     * 里面的流程图
     */
    checkflow() {
      this.checkflowVisible = true;
      this.docViewloading = true;
      axios
        .get("checkFlow", {
          DocNo: this.DocNo, //单据编号
          DocType: this.DocType //类型为报销款单
        })
        .then(res => {
          this.docView = res;
          setTimeout(() => {
            this.docViewloading = false;
          }, 800);
        })
        .catch(err => {
          console.log(err);
        });
    },
    //沟通窗口打开 
    Communication(){
      this.dialogCommunicationVisible = true;
      this.isshowLauch=false;
      let all = [
          axios.get('CommunicationContent',{
            key:this.DocNo,
            DocType:this.DocType
          }),
          axios.get('LaunchList',{
            key:this.DocNo,
            DocType:this.DocType
          }),
          axios.get('getCommuniState',{
            key:this.DocNo,
            DocType:this.DocType,
            types:this.Type
          })
      ];
      this.axios.all(all).then(
        this.axios.spread((res1,res2,res3)=>{
            this.CommunicationContentList = res1;//获得沟通内容
            for(var i=0;i<this.CommunicationContentList.length;i++){
              if(this.CommunicationContentList[i].Img==''){//如果是空的
                const ac = this.acquiescenceImg;
                this.CommunicationContentList[i].Img = ac;//赋值默认头像
              }
            }
            this.requestEmp = res2.RequestEmp;//申请人ID
            this.LaunchList = res2.us;//获得沟通对象  
            this.communiTypes = res3;//获取沟通状态
        })
      )   
    },
    //允许提交者编辑单据Change事件
    launchChange(e){
      console.log(e,'e');
      if(e){
        console.log(this.requestEmp,'this.requestEmp');
        console.log(this.launch,'this.launch');
        let bo=true;
        for(let i=0;i<this.launch.length;i++)
        { 
          if(this.launch[i]==this.requestEmp)
          bo=false;      
        }
        if(bo)this.launch.push(this.requestEmp);
      }
    },
    //确认后提交
    CommunicationDetermine(){
      if(this.isshowLauch == true)
      {
        this.$confirm('回复沟通单据将会自动提交，不可再编辑!', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
           this.Communicate();
        }).catch(() => {
          this.$message({
            type: 'info',
            message: '已取消'
          });           
        });
      }else{
        this.Communicate();
      }
    },
    //沟通窗口 确定按钮
    Communicate(){
      let user='';
      for(let i=0;i<this.launch.length;i++)
      { 
          user+=i!=0?',':'';
          user+=this.launch[i];
      }    
      console.log(user,'user');
      axios.get('AddCommunicate',{
          key:this.DocNo,
          DocType:this.DocType,
          msg:this.contentInput,
          user:user,
          bj:this.launchChecked ? 1 : 0,
          type:this.communiTypes
      }).then(res=>{
          if(res.Success===true){
            if(this.isshowLauch == true)
            this.SubmitForm();
            //获得沟通内容
            this.getContent();
            this.$message({
              message: res.Message,
              type: 'success',
              duration: 1200
            })
            this.getState();
            this.contentInput = '';
          }else{
            this.$message({
              message: res.Message,
              type: 'warning',
              duration: 1200
            })
          }
      }).catch(err=>{
          console.log(err);
      })      
    },
    //获取内容
    getContent(){
      axios.get('CommunicationContent',{
        key:this.DocNo,
        DocType:this.DocType
      }).then(res=>{
        this.CommunicationContentList = res;
        for(var i=0;i<this.CommunicationContentList.length;i++){
            if(this.CommunicationContentList[i].Img==''){//如果是空的
                const ac = this.acquiescenceImg;
                this.CommunicationContentList[i].Img = ac;//赋值默认头像
            }
        }    
      })
    },
    //获取type
    getState(){
      axios.get('getCommuniState',{
        key:this.DocNo,
        DocType:this.DocType,
        types:this.Type
      }).then(res=>{
        this.communiTypes = res;
        console.log(this.communiTypes,'type1');        
      }).catch(err=>{
        console.log(err);
      })
    },
    //驳回 收入确认单按钮
    rejectIncome() {  
      axios
        .get('ExamineCommunication',{
          key:  this.DocNo,
          DocType:  this.DocType
        }).then(res => {
          if(res.Data === '1'){
            this.$confirm(res.Message, '提示', {
              confirmButtonText: '确定',
              cancelButtonText: '取消',
              type: 'warning'
            }).then(() => {
              this.IsRejectIncome();
            }).catch(() => {
                this.$message({
                type: "info",
                message: "已取消"
              });
            });
          }else
            this.IsRejectIncome();
        })
        .catch(err => {
          console.log(err);
        })
    },
    //驳回收入确认单 操作
    IsRejectIncome() {
      /* const timer  = moment(this.docDate).format('YYYY-MM-DD');  */
      /* this.DocNo = getQueryParam("key"); */
      this.$prompt("请您输入驳回的理由", "提示", {
          confirmButtonText: "确定",
          cancelButtonText: "取消"
        })
        .then(({
          value
        }) => {
          this.$message({
            type: "success",
            message: "你的驳回的理由是：" + value
          });
          axios
            .get("rejectIncome", {
              key: this.DocNo,
              type: 1, //0审核 1驳回
              Reason: value,
              Income_DocDate:this.docDate
            })
            .then(res => {
              this.$message({
                message: res,
                type: "success"
              });
            })
            .catch(err => {
              console.log(err);
            });
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "取消输入"
          });
        });
    },
    //审核 收入确认单列表
    getAuditPeriodList(){
      this.period = '';
      this.dialogPeriodVisible = true;
      let msg = this.Msg;
      axios.get('getPeriod',{type:0}).then((res)=>{
        this.PeriodList = res;//获取现金期间列表
        console.log(this.PeriodList);
      }).catch((err)=>{
        console.log(err);        
      })
    },
    //审核 收入确认单按钮
    auditIncome(){  
        axios.get('ExamineCommunication',{
          key:  this.DocNo,
          DocType:  this.DocType
        }).then(res => {
          if(res.Data === '1'){//判断是否未回复沟通
            this.$confirm(res.Message, '提示', {//弹未回复是否继续窗口
              confirmButtonText: '确定',
              cancelButtonText: '取消',
              type: 'warning'
            }).then(() => {
              this.IsAuditPeriod();//如果是就判断是就弹出选择现金期间窗口
            }).catch(() => {
                this.$message({
                type: "info",
                message: "已取消"
              });
            });
          } else if(res.Data === '2') {
            this.$message({
              type: "warning",
              message: res.Message
            });
          }else //如果未有沟通就弹出是否现金期间窗口
            this.IsAuditPeriod();
        })
        .catch(err => {
          console.log(err);
        })
    },
    showChange(isSwitch){
      if (this.custom=='') {//打开“是否预收款”按钮，如果客户栏为空 
        this.$message({
          message: '请先选择客户！',
          type: 'warning',
          duration: 1200
        });
        setTimeout(()=>{
          this.isSwitch=false;
        },1000)
        return  
      }
      this.isShowPayment = isSwitch;
      if (isSwitch) {//同时打开弹框
        this.getPaymentAddDiaLog()
      }else{//关闭弹框时，弹框的金额也清空,并且上次掉收入明细中对应的数据
        // console.log(this.paymentsTemp,"paymentsTemp")
        // console.log(this.paymentsPrint,"paymentsPrint上表")
        // console.log(this.detail,"detail下表")
        //收入明细detail中DocNo为空代表新添加行的数据
        this.detail=this.detail.filter(item=>item.DocNo=="")
        if (this.detail.length==0) {//收入明细数据为空时，默认留下一行空行
          this.addlist()
        }
        //   弹框的金额清空     
        this.paymentsTemp.forEach(item=>item.Money="");
        //预收明细清空
        this.paymentsPrint=[];
      }
    },
    //判断当前年月是否现金期间
    IsAuditPeriod(){
      axios.get("isPeriod", {
        key:this.DocNo
      }).then(res => { 
        if(res=="1")
          //获取现金期间列表
          this.getAuditPeriodList();
          else 
          //现金期间窗口的审核按钮
          this.auditDetermine();
        }).catch(err => {
          console.log(err);
        });
    },
    //现金期间窗口的审核按钮
    auditDetermine(){
      this.checkMsg();//审核提示
      this.$confirm(this.Msg, {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning",
          beforeClose: (action, instance, done) =>{
            if('confirm' !== action) { return done(); }
            instance.confirmButtonLoading = true;
            axios.get("auditIncome", {
              key: this.DocNo,
              type: 0, //0审核 1驳回
              Income_DocDate: this.docDate,//单据日期
              Period:this.period//现金期间
            })
            .then(res => {
              instance.confirmButtonLoading = false;
              if(res==="审核成功"){        
                setTimeout(()=>{
                  this.$router.push({ path:"/notAudit" });   
                },1000);

                this.$message({
                  type: "success",
                  message: res,
                  duration: 1000
                });
                done();
              } else {
                this.$message({
                  type: "warning",
                  message: res,
                  duration: 1500
                });   
              }
            })
            .catch(err => {
              console.log(err);
            });
          }
        })
        .then(() => {
            
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消"
          });
        }); 
    },
    //取消按钮 关闭窗口    
    CancelPeriod() {
      this.dialogPeriodVisible = false;
    },
    //审核提示
    checkMsg() {
      axios
        .get("checkMsg")
        .then(res => {
          this.Msg = res;
        })
        .catch(err => {
          console.log(err);
        });
    },
    // 撤销
    repeal(index, row) {
      this.$confirm("确认撤销该记录吗?", "提示", {
          type: "warning"
        })
        .then(() => {
          axios
            .post("revokeIncome", {
              key: row.Income_DocNo
            })
            .then(res => {
              this.$message({
                message: res.Message,
                type: "success",
                duration: 1200
              });
              this.getList();
            })
            .catch(err => {
              console.log(err);
            });
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消撤销"
          });
        });
    },
    preview(scoped) {
      console.log(this.$refs["images"]);
      if (this.viewer) {
        this.viewer.destroy();
      }
      this.viewer = new this.$Viewer(this.$refs["images"], {
        url: "src",
        toolbar: {
          zoomIn: {
            show: 4,
            size: "large"
          },
          zoomOut: {
            show: 4,
            size: "large"
          },
          prev: {
            show: 4,
            size: "large"
          },
          next: {
            show: 4,
            size: "large"
          },
          rotateLeft: {
            show: 4,
            size: "large"
          },
          rotateRight: {
            show: 4,
            size: "large"
          }
        }
      });
      console.log(this.$refs["images"].childNodes[scoped.$index])     
      this.$refs["images"].childNodes[scoped.$index].childNodes[0].click()
    },
    async remoteMethod(query) {
      if (query !== '') {
          this.loading = true;
          this.Customer = await axios.post('getCustomerQuery', {query});
          console.log(this.Customer,'Customer');
          this.loading = false;
      } else {
        this.Customer = [];
      }
    },
    //打开附件列表窗口
    openUploadDialog() {
      this.dialogUploadVisible = true;
      this.getUploadList();
    },
    //附件列表
    async getUploadList() {
      const res = await axios.get('UploadList', {
        key: this.DocNo,
        type: this.DocType,
        page: 1, //一页
        rows: 5000 //显示5000条
      })
      this.UploadList = res.rows;
    },
    //删除附件
    async DeleUpload(index,row) {
      const res = await axios.get('deleUpload',{key:row.ID})
      if (res.Success) {
          this.$message({
            message: res.Message,
            type: "success"
          })
          this.getUploadList();
      }else{
          this.$message({
            message: res.Message,
            type: "error"
          })
      }
    },
     //判断是否显示预览按钮
    isShowPreview (name) {
      var fileType = ['gif','jpg','png','JPG','PNG'];
      var temp = name.substring(name.lastIndexOf('.')+1);
      if(fileType.indexOf(temp) > -1) {
        return true
      }else {
        return false
      }
    },
    //打印
    printPdf() {
      $("#form1").jqprint({
        debug: false,
        importCSS: true,
        printContainer: false,
        operaSupport: false
      });
    },
    //开始上传附件
    update(e) { 
      for(var i=0 ;i < e.target.files.length;i++){
        let file = e.target.files[i];
        let param = new FormData(); //创建form对象
        param.append('fileData', file); //通过append向form对象添加数据
        param.append('chunk', '0'); //添加form表单中其他数据
        param.append('key', this.DocNo); //添加form表单中其他数据
        param.append('Type', this.DocType);
        console.log(param.get('file')); //FormData私有类对象，访问不到，可以通过get判断值是否传进去
        let config = {
          headers: {
            'Content-Type': 'multipart/form-data'
          }
        }; //添加请求头
        axios.post('Upload', param, config).then(res => {
          if(res.Success){
            this.$message({
              message: `上传成功`,
              type: 'success',
              duration: 800
            });
          }else{
            this.$message({
              message: res.Message,
              type: 'warning',
              duration: 2000
            });
          }
          this.getUploadList();
        }).catch(err => {
          console.log(err)
        })
      }
    }
  },
  mounted() {
    this.getList();
    this.checkMsg();
    if (this.$route.query.showNum && this.$route.query.key) {
      this.handleEdit();
    }
    if(this.$route.query.News){
      this.handleAdd();
    }
  },
  computed:{
    Count(){
      let sum = 0;
      for (let i of this.detail){
        sum += Number(i.IncomeMoney)
      }
      return sum.toFixed(2);
    },
    Count1(){
      let sum = 0;
      for (let i of this.paymentsPrint){
        sum += Number(i.Money)
      }
      return sum.toFixed(2);
    },
    
  }
};
</script>
<style scoped lang="scss">
@import "../../common/css/index.css";
.toolbar h2 {
  line-height: 36px;
  margin: 0 10px 0 0;
}

</style>
